📄 form1.frm
字号:
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5880
TabIndex = 20
Top = 660
Width = 495
End
Begin VB.Label Label1
Caption = "姓 名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 3000
TabIndex = 19
Top = 300
Width = 975
End
Begin VB.Label Label1
Caption = "出生年月"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 2
Left = 120
TabIndex = 18
Top = 660
Width = 975
End
Begin VB.Label Label1
Caption = "家庭住址"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 3
Left = 120
TabIndex = 17
Top = 1380
Width = 975
End
Begin VB.Label Label1
Caption = "邮政编码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 4
Left = 3000
TabIndex = 16
Top = 660
Width = 975
End
Begin VB.Label Label1
Caption = "联系电话"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 5
Left = 3000
TabIndex = 15
Top = 1035
Width = 975
End
Begin VB.Label Label1
Caption = "入学时间"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 6
Left = 120
TabIndex = 14
Top = 1020
Width = 975
End
Begin VB.Label Label1
Caption = "备 注"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 7
Left = 120
TabIndex = 13
Top = 1800
Width = 975
End
End
Begin VB.Label Label10
Caption = "入学登记"
BeginProperty Font
Name = "楷体_GB2312"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 375
Left = 3000
TabIndex = 23
Top = 0
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim txtsql1 As String
Private Sub Combo1_Click(Index As Integer)
Dim mrc As ADODB.Recordset
txtsql1 = "select 专业,年制 from class where 班级='" & Trim(Combo1(1).Text) & "'"
Set mrc = ExecuteSQL(txtsql1)
mrc.Close
End Sub
Private Sub Combo1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{TAB}"
End If
End Sub
Private Sub Command1_Click()
For j = 0 To 7
If Text1(j) = "" Then
ss = MsgBox(Label1(j).Caption & "不能为空!", vbExclamation + vbOKOnly, "警告")
Text1(j).SetFocus
Text1(j).SelStart = 0
Text1(j).SelLength = Len(Text1(j).Text)
Exit Sub
End If
Next
Dim mrc As ADODB.Recordset
txtsql1 = "select * from xj where 学号='" & Trim(Text1(0).Text) & "'"
Set mrc = ExecuteSQL(txtsql1)
If modi = False Then
If mrc.EOF = False Then
sss = MsgBox("已经存在该学号的记录,学号不能重复!", vbExclamation + vbOKOnly, "警告")
Text1(0).SetFocus
Text1(0).SelStart = 0
Text1(0).SelLength = Len(Text1(0).Text)
mrc.Close
Exit Sub
End If
End If
If Not IsDate(Text1(2).Text) Then '判断是否日期格式
ssss = MsgBox("应输入日期 mm-dd-yy", vbInformation + vbOKOnly, "警告")
Text1(2).SetFocus
Text1(2).SelStart = 0
Text1(2).SelLength = Len(Text1(2).Text)
Exit Sub
End If
If Not IsDate(Text1(6).Text) Then
ssss = MsgBox("应输入日期 mm-dd-yy", vbInformation + vbOKOnly, "警告")
Text1(6).SetFocus
Text1(6).SelStart = 0
Text1(6).SelLength = Len(Text1(6).Text)
Exit Sub
End If
If modi = True Then
txtsql1 = "update xj set 学号='" & Trim(Text1(0).Text) & "',姓名='" & Trim(Text1(1).Text) & "',性别='" & Trim(Combo1(0).Text) & "',班级='" & Trim(Combo1(1).Text) & "',出生年月=#" & Trim(Text1(2).Text) & "# ,家庭住址='" & Trim(Text1(3).Text) & "' ,邮政编码='" & Trim(Text1(4).Text) & "' ,联系电话='" & Trim(Text1(5).Text) & "' ,入学时间=#" & Trim(Text1(6).Text) & "# ,备注='" & Trim(Text1(7).Text) & "'where 学号='" & Trim(Form3.MSF1.TextMatrix(Form3.MSF1.Row, 1)) & "'"
Set mrc = ExecuteSQL(txtsql1)
txtsql1 = "update cj set 学号='" & Trim(Text1(0).Text) & "' where 学号='" & Trim(Form3.MSF1.TextMatrix(Form3.MSF1.Row, 1)) & "'"
Set mrc = ExecuteSQL(txtsql1)
txtsql1 = "update jf set 学号='" & Trim(Text1(0).Text) & "' where 学号='" & Trim(Form3.MSF1.TextMatrix(Form3.MSF1.Row, 1)) & "'" 'Set mrc = ExecuteSQL(txtsql1)
Unload Me
Exit Sub
End If
txtsql1 = "select * from xj "
Set mrc = ExecuteSQL(txtsql1)
mrc.AddNew
For i = 4 To 9
mrc.Fields(i) = Text1(i - 2).Text
Next i
mrc.Fields(0) = Trim(Text1(0).Text)
mrc.Fields(1) = Trim(Text1(1).Text)
mrc.Fields(2) = Trim(Combo1(0).Text)
mrc.Fields(3) = Trim(Combo1(1).Text)
mrc.Update
Set mrc = Nothing
For j = 0 To 7
Text1(j) = ""
Next
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Text1(0).SetFocus
Form1.load1
End Sub
Public Sub load1()
Dim mrc As ADODB.Recordset
txtsql1 = "select DISTINCT 班级 from class order by 班级"
Set mrc = ExecuteSQL(txtsql1)
If mrc.EOF Then
ddd = MsgBox("请先设置班级部署!", "警告")
mrc.Close
Exit Sub
End If
Combo1(1).Clear
mrc.MoveFirst
Do While Not mrc.EOF
Combo1(1).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Combo1(1).ListIndex = 0
Combo1(0).ListIndex = 0
If modi Then '如果是修改状态
Me.Caption = "修改"
txtsql1 = "select * from xj where 学号='" & Trim(Form3.MSF1.TextMatrix(Form3.MSF1.Row, 1)) & "'"
Set mrc = ExecuteSQL(txtsql1)
mrc.MoveFirst
For i = 4 To 9
Text1(i - 2).Text = mrc.Fields(i)
Next i
Text1(0).Text = mrc.Fields(0)
Text1(1).Text = mrc.Fields(1)
Combo1(0).Text = mrc.Fields(2)
Combo1(1).Text = mrc.Fields(3)
mrc.Close
Else
Me.Caption = "登记"
For i = 2 To 7
Text1(i).Text = ""
Next i
Text1(6).Text = Date
Text1(0).Text = ""
Text1(1).Text = ""
End If
End Sub
Private Sub Text1_GotFocus(Index As Integer)
If Index = 6 Then
Text1(6).SelStart = 0
Text1(6).SelLength = Len(Text1(6).Text)
End If
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{TAB}"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -