📄 addnewfrm.frm
字号:
VERSION 5.00
Begin VB.Form addnewfrm
Caption = "Form5"
ClientHeight = 5985
ClientLeft = 60
ClientTop = 345
ClientWidth = 7050
LinkTopic = "Form5"
ScaleHeight = 5985
ScaleWidth = 7050
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "返回"
Height = 495
Left = 3240
TabIndex = 15
Top = 5280
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "保存"
Height = 495
Left = 1080
TabIndex = 14
Top = 5280
Width = 1695
End
Begin VB.OptionButton Option2
Caption = "未交"
Height = 315
Left = 3600
TabIndex = 13
Top = 4560
Width = 975
End
Begin VB.OptionButton Option1
Caption = "已交"
Height = 375
Left = 2640
TabIndex = 12
Top = 4560
Width = 1095
End
Begin VB.TextBox Text6
Height = 495
Left = 2040
TabIndex = 10
Top = 3480
Width = 1935
End
Begin VB.TextBox Text4
Height = 495
Left = 3600
TabIndex = 8
Top = 1200
Width = 1575
End
Begin VB.TextBox Text3
Height = 615
Left = 3840
TabIndex = 6
Top = 2400
Width = 2415
End
Begin VB.TextBox Text2
Height = 615
Left = 960
TabIndex = 4
Top = 2400
Width = 1695
End
Begin VB.TextBox Text1
Height = 615
Left = 960
TabIndex = 2
Top = 1200
Width = 1335
End
Begin VB.Label Label8
Caption = "交纳宿舍费状态"
Height = 495
Left = 600
TabIndex = 11
Top = 4440
Width = 1695
End
Begin VB.Label Label6
Caption = "荟园8栋"
Height = 495
Left = 480
TabIndex = 9
Top = 3480
Width = 735
End
Begin VB.Label Label5
Caption = "学号"
Height = 495
Left = 2880
TabIndex = 7
Top = 1200
Width = 1335
End
Begin VB.Label Label4
Caption = "专业"
Height = 495
Left = 3120
TabIndex = 5
Top = 2520
Width = 975
End
Begin VB.Label Label3
Caption = "学院"
Height = 375
Left = 360
TabIndex = 3
Top = 2520
Width = 1095
End
Begin VB.Label Label2
Caption = "姓名"
Height = 375
Left = 360
TabIndex = 1
Top = 1320
Width = 975
End
Begin VB.Label Label1
Caption = "添加学生住宿信息"
Height = 495
Left = 240
TabIndex = 0
Top = 240
Width = 2655
End
End
Attribute VB_Name = "addnewfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
If Text1.Text = "" Then
MsgBox "请输入姓名!", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Exit Sub
End If
If Text4.Text = "" Then
MsgBox "请输入学号!", vbOKOnly + vbExclamation, "警告"
Text4.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "请输入学院!", vbOKOnly + vbExclamation, "警告"
Text2.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "请输入专业!", vbOKOnly + vbExclamation, "警告"
Text3.SetFocus
Exit Sub
End If
If Text6.Text = "" Then
MsgBox "请输入宿舍号!", vbOKOnly + vbExclamation, "警告"
Text6.SetFocus
Exit Sub
End If
txtSQL = Trim("select student.sno,sname,sxueyuan,szhuanye,ifpay from student ")
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Text4.Text)
mrc.Fields(1) = Trim(Text1.Text)
mrc.Fields(2) = Trim(Text2.Text)
mrc.Fields(3) = Trim(Text3.Text)
If Option1.Value = True Then
mrc.Fields(4) = Char '1'
End If
If Option2.Value = True Then
mrc.Fields(4) = Char '0'
End If
mrc.Update
mrc.Close
txtSQL = Trim("select * from sturoom")
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.Fields(0) = Trim(Text4.Text)
mrc.Fields(1) = Trim(Text6.Text)
mrc.Update
mrc.Close
MsgBox "添加学籍信息成功!", vbOKOnly + vbExclamation, "警告"
Me.Hide
End Sub
Private Sub Command2_Click()
Me.Hide
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -