form6.frm
来自「本人课程设计做的一个简单的教务辅助管理系统,实现了数据库的一般操作,适合初学者学」· FRM 代码 · 共 515 行 · 第 1/2 页
FRM
515 行
rs.Fields(1) = Text2.Text
rs.Fields(2) = Combo1.Text
rs.Fields(3) = Combo2.Text
rs.Fields(4) = Text8.Text
rs.Fields(5) = Text4.Text
rs.Fields(6) = Text5.Text
rs.Fields(7) = Combo3.Text
rs.Fields(8) = Text9.Text
rs.Update
MsgBox "添加成功!"
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Combo3.Text = ""
Text9.Text = ""
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
Combo2.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Combo3.Text = ""
Text9.Text = ""
Combo1.AddItem "男"
Combo1.AddItem "女"
Combo2.AddItem "讲师"
Combo2.AddItem "副教授"
Combo2.AddItem "教授"
Combo3.AddItem "大专"
Combo3.AddItem "本科"
Combo3.AddItem "硕士研究生"
Combo3.AddItem "博士研究生"
Combo3.AddItem "博士后"
Text2.Enabled = False
Combo1.Enabled = False
Combo2.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Combo3.Enabled = False
Text9.Enabled = False
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text1.Text = "" Then
MsgBox "请输入教师号!", vbExclamation, "提示信息"
Text1.Text = ""
Text1.SetFocus
ElseIf IsNumeric(Text1) = False Then
MsgBox "请输入数字!", vbExclamation, "提示信息"
Text1.Text = ""
Text1.SetFocus
Else
Text2.Enabled = True
Text2.SetFocus
End If
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Len(Text2) > 8 Then
MsgBox "字符超长,请重新输入!", vbExclamation, "提示信息"
Text2.Text = ""
Text2.SetFocus
ElseIf Text2.Text = "" Then
MsgBox "请输入教师名!", vbExclamation, "提示信息"
Text2.Text = ""
Text2.SetFocus
Else
Combo1.Enabled = True
End If
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text4.Text = "" Then
MsgBox "请输入教师籍贯!", vbExclamation, "提示信息"
Text4.Text = ""
Text4.SetFocus
Else
Text5.Enabled = True
Text5.SetFocus
End If
End If
End Sub
Private Sub Text5_Change()
Text5.SetFocus
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text5.Text = "" Then
MsgBox "请输入出生年份!", vbExclamation, "提示信息"
Text5.Text = ""
Text5.SetFocus
ElseIf IsNumeric(Text5) = False Then
MsgBox "请输入数字!", vbExclamation, "提示信息"
Text5.Text = ""
Text5.SetFocus
ElseIf Val(Text5.Text) < 1920 Or Val(Text5.Text) > 2006 Then
MsgBox "请输入真实出生年份", vbExclamation, "提示信息"
Text5.Text = ""
Text5.SetFocus
Else
year = Trim(Text5.Text)
Text6.Enabled = True
Text6.SetFocus
End If
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text6.Text = "" Then
MsgBox "请输入月份!", vbExclamation, "提示信息"
Text6.Text = ""
Text6.SetFocus
ElseIf IsNumeric(Text6) = False Then
MsgBox "请输入数字!", vbExclamation, "提示信息"
Text6.Text = ""
Text6.SetFocus
ElseIf Val(Text6.Text) < 1 Or Val(Text6.Text) > 12 Then
MsgBox "请输入真实出生月份", vbExclamation, "提示信息"
Text6.Text = ""
Text6.SetFocus
Else
month = Trim(Text6.Text)
Text7.Enabled = True
Text7.SetFocus
End If
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case month
Case 1, 3, 5, 7, 8, 10, 12
day = 31
Case 4, 6, 9, 11
day = 30
Case 2
If year Mod 400 = 0 Or (year Mod 4 = 0 And year Mod 100 <> 0) Then
day = 29
Else
day = 28
End If
End Select
If Text7.Text = "" Then
MsgBox "请输入日期!", vbExclamation, "提示信息"
Text7.Text = ""
Text7.SetFocus
ElseIf IsNumeric(Text7) = False Then
MsgBox "请输入数字!", vbExclamation, "提示信息"
Text7.Text = ""
Text7.SetFocus
ElseIf Val(Text7.Text) < 1 Or Val(Text7.Text) > day Then
MsgBox "请输入真实出生月份", vbExclamation, "提示信息"
Text5.Text = ""
Text5.SetFocus
Else
Text5 = Text5 + "." + Text6 + "." + Text7
Text8.Enabled = True
Text8.SetFocus
End If
End If
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text8.Text = "" Then
MsgBox "请输入所在系!", vbExclamation, "提示信息"
Text8.Text = ""
Text8.SetFocus
Else
Combo2.Enabled = True
Combo2.SetFocus
End If
End If
End Sub
Private Sub Text9_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?