📄 frmjgxxgl.frm
字号:
End Sub
Private Sub CmdDel_Click()
Select Case SSTab1.Tab
Case 0
If List1.ListIndex > -1 Then
If vbYes = MsgBox("确认索要删除此记录么?", vbYesNo, "删除对话框") Then
RS0.Delete
List1.Clear
ComBm_Click
End If
End If
CmdAdd.Enabled = True
CmdMdi.Enabled = False
CmdDel.Enabled = False
CmdSave.Enabled = False
CmdCancel.Enabled = False
Case 1
If List2.ListIndex > -1 Then
If vbYes = MsgBox("确认索要删除此记录么?", vbYesNo, "删除对话框") Then
RS2.Delete
List2.Clear
ListAdd2
End If
End If
Case 2
If List3.ListIndex > -1 Then
If vbYes = MsgBox("确认索要删除此记录么?", vbYesNo, "删除对话框") Then
RS3.Delete
List3.Clear
ListAdd3
End If
End If
End Select
End Sub
Private Sub CmdMdi_Click()
Select Case SSTab1.Tab
Case 0
Czp = 1
AddFlg = False
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Combo1.Enabled = True
Combo2.Enabled = True
For Each ctl In Controls
If TypeOf ctl Is MaskEdBox Then
ctl.Enabled = True
End If
Next ctl
Case 1
Czp = 2
Text10.Enabled = True
Text11.Enabled = True
Text12.Enabled = True
Text13.Enabled = True
Text14.Enabled = True
Text15.Enabled = True
AddFlg = False
Case 2
Czp = 3
Text21.Enabled = True
Text20.Enabled = True
Text19.Enabled = True
Text18.Enabled = True
Text17.Enabled = True
Text16.Enabled = True
AddFlg = False
End Select
CmdAdd.Enabled = False
CmdMdi.Enabled = False
CmdDel.Enabled = False
CmdSave.Enabled = True
CmdCancel.Enabled = True
End Sub
Private Sub CmdSave_Click()
On Error GoTo err
Select Case Czp
Case 1
If Trim(Text1.Text) = "" Or Trim(Text2.Text) = "" Or Trim(Text3.Text) = "" Or Trim(Text1.Text) = "" Or Trim(Text4.Text) = "" Or Trim(Text5.Text) = "" Or Trim(Text6.Text) = "" Or Trim(Text7.Text) = "" Or Trim(Text8.Text) = "" Or Trim(Text9.Text) = "" Then
MsgBox "记录输入不完整!"
Exit Sub
End If
If Combo1.ListIndex = -1 And (Combo1.Text <> "男" And Combo1.Text <> "女") Then
MsgBox "记录输入不完整!"
Exit Sub
End If
If Combo2.ListIndex = -1 And (Combo2.Text <> "是" And Combo2.Text <> "否") Then
MsgBox "记录输入不完整!"
Exit Sub
End If
RS0!姓名 = Trim(Text1.Text)
RS0!性别 = Trim(Combo1.Text)
RS0!出生年月 = Trim(MaskEdBox1.Text)
RS0!第一学历 = Trim(Text4.Text)
RS0!一学历时间 = Trim(MaskEdBox2.Text)
RS0!最终学历 = Trim(Text5.Text)
RS0!终学历时间 = Trim(MaskEdBox3.Text)
RS0!参加工作时间 = Trim(MaskEdBox4.Text)
RS0!职称 = Trim(Text3.Text)
RS0!职务 = Trim(Text6.Text)
RS0!联系电话 = Trim(Text8.Text)
RS0!联系手机 = Trim(Text9.Text)
RS0!家庭住址 = Trim(Text2.Text)
RS0!婚否 = Trim(Combo2.Text)
RS0!备注 = Trim(Text7.Text)
RS0!部门 = Trim(ComBm.Text)
If AddFlg = True Then
List1.Enabled = True
RS0.Update
RS0.MoveNext
If RS0.EOF Then RS0.MoveLast
MsgBox "记录成功添加!"
Else
RS0.UpdateBatch adAffectAllChapters
RS0.MoveNext
If RS0.EOF Then RS0.MoveLast
MsgBox "记录成功修改!"
End If
Case 2
RS2!姓名 = List1.Text
RS2!作品名称 = Text10.Text
RS2!科目 = Text11.Text
RS2!出版社 = Text12.Text
RS2!合作者 = Text13.Text
RS2!发表位置 = Text14.Text
RS2!发表时间 = Text15.Text
If AddFlg = True Then
List2.Enabled = True
RS2.Update
RS2.MoveNext
If RS2.EOF Then RS2.MoveLast
MsgBox "记录成功添加!"
Else
RS2.UpdateBatch adAffectAllChapters
RS2.MoveNext
If RS2.EOF Then RS2.MoveLast
MsgBox "记录成功修改!"
End If
Case 3
RS3!姓名 = List1.Text
RS3!名称 = Text21.Text
RS3!科目 = Text20.Text
RS3!课时 = Text19.Text
RS3!开始时间 = Text18.Text
RS3!结束时间 = Text17.Text
RS3!主办单位 = Text16.Text
If AddFlg = True Then
List3.Enabled = True
RS3.Update
RS3.MoveNext
If RS3.EOF Then RS3.MoveLast
MsgBox "记录成功添加!"
Else
RS3.UpdateBatch adAffectAllChapters
RS3.MoveNext
If RS3.EOF Then RS3.MoveLast
MsgBox "记录成功修改!"
End If
End Select
CmdAdd.Enabled = True
CmdMdi.Enabled = False
CmdDel.Enabled = False
CmdSave.Enabled = False
CmdCancel.Enabled = False
For Each ctl In Controls
If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Or TypeOf ctl Is MaskEdBox Then
ctl.Enabled = False
End If
Next ctl
ComBm.Enabled = True
List1.Clear
ComBm_Click
List2.Clear
List3.Clear
ListAdd2
ListAdd3
Exit Sub
err:
Call ExecErr(Date, Me.Caption, err.Number, err.Source, err.Description)
End Sub
Private Sub ComBm_Click()
Set RS0 = New ADODB.Recordset
RSCount.Caption = ""
If Trim(ComBm.Text) = "" Then
Else
RS0.Open "select * from 教工表 where 部门 = '" & ComBm.Text & "'", Con, adOpenStatic, adLockPessimistic, adCmdText
If RS0.EOF = True Then
List1.Clear
RSCount.Caption = "本部门现有" & RS0.RecordCount & "人!"
DataNull
List1.Clear
CmdAdd.Enabled = False
CmdMdi.Enabled = False
CmdDel.Enabled = False
CmdSave.Enabled = False
CmdCancel.Enabled = False
Else
RSCount.Caption = "本部门现有" & RS0.RecordCount & "人!"
List1.Clear
For rcount = 1 To RS0.RecordCount
List1.AddItem RS0!姓名
RS0.MoveNext
Next rcount
CmdAdd.Enabled = True
List1.ListIndex = 0
End If
End If
List2.Clear
List3.Clear
ListAdd2
ListAdd3
End Sub
Private Sub Form_Load()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "部门表", Con, adOpenStatic, adLockPessimistic, adCmdTable
ComBm.Clear
Do While Not rs.EOF
ComBm.AddItem rs!部门
rs.MoveNext
Loop
If ComBm.ListCount > 0 Then
ComBm.ListIndex = 0
End If
End Sub
Private Sub DataNull()
Dim ctl As Control
For Each ctl In Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next ctl
For Each ctl In Controls
If TypeOf ctl Is MaskEdBox Then
ctl.Text = "1980.12"
End If
Next ctl
List2.Clear
List3.Clear
Combo1.Text = "男"
Combo2.Text = "否"
End Sub
Private Sub List1_Click()
RS0.Move List1.ListIndex, adBookmarkFirst
List2.Clear
List3.Clear
ListAdd2
ListAdd3
Display1
End Sub
Private Sub Display1()
If RS0.BOF And RS0.EOF Then
CmdMdi.Enabled = False
CmdDel.Enabled = False
Else
If RS0.EOF Then RS0.MoveLast
CmdMdi.Enabled = True
CmdDel.Enabled = True
If RS0.BOF Then RS0.MoveFirst
If RS0.EOF Then RS0.MoveLast
Text1.Text = "" & RS0!姓名
Combo1.Text = "" & RS0!性别
MaskEdBox1.Text = "" & RS0!出生年月
Text4.Text = "" & RS0!第一学历
MaskEdBox2.Text = "" & RS0!一学历时间
Text5.Text = "" & RS0!最终学历
MaskEdBox3.Text = "" & RS0!终学历时间
MaskEdBox4.Text = "" & RS0!参加工作时间
Text3.Text = "" & RS0!职称
Text6.Text = "" & RS0!职务
Text8.Text = "" & RS0!联系电话
Text9.Text = "" & RS0!联系手机
Text2.Text = "" & RS0!家庭住址
Combo2.Text = "" & RS0!婚否
Text7.Text = "" & RS0!备注
End If
End Sub
Private Sub ListAdd2()
Set RS2 = New ADODB.Recordset
If List1.ListIndex > -1 Then
RS2.Open "select * from 作品表 where 姓名= '" & List1.Text & "'", Con, adOpenStatic, adLockPessimistic, adCmdText
Do While Not RS2.EOF
List2.AddItem RS2!作品名称
RS2.MoveNext
Loop
Else
RS2.Open "作品表", Con, adOpenStatic, adLockPessimistic, adCmdTable
End If
End Sub
Private Sub ListAdd3()
Set RS3 = New ADODB.Recordset
If List1.ListIndex > -1 Then
RS3.Open "select * from 继续教育 where 姓名= '" & List1.Text & "'", Con, adOpenStatic, adLockPessimistic, adCmdText
Do While Not RS3.EOF
List3.AddItem RS3!名称
RS3.MoveNext
Loop
Else
RS3.Open "继续教育", Con, adOpenStatic, adLockPessimistic, adCmdTable
End If
End Sub
Private Sub List2_Click()
RS2.Move List2.ListIndex, adBookmarkFirst
display2
End Sub
Private Sub display2()
If List2.ListIndex > -1 Then
If RS2.BOF And RS2.EOF Then
CmdMdi.Enabled = False
CmdDel.Enabled = False
Else
If RS2.EOF Then RS2.MoveLast
CmdMdi.Enabled = True
CmdDel.Enabled = True
If RS2.BOF Then RS2.MoveFirst
If RS2.EOF Then RS2.MoveLast
Text10.Text = "" & RS2!作品名称
Text11.Text = "" & RS2!科目
Text12.Text = "" & RS2!出版社
Text13.Text = "" & RS2!合作者
Text14.Text = "" & RS2!发表位置
Text15.Text = "" & RS2!发表时间
End If
End If
End Sub
Private Sub Display3()
If List3.ListIndex > -1 Then
If RS3.BOF And RS3.EOF Then
CmdMdi.Enabled = False
CmdDel.Enabled = False
Else
If RS3.EOF Then RS3.MoveLast
CmdMdi.Enabled = True
CmdDel.Enabled = True
If RS3.BOF Then RS3.MoveFirst
If RS3.EOF Then RS3.MoveLast
Text21.Text = "" & RS3!名称
Text20.Text = "" & RS3!科目
Text19.Text = "" & RS3!课时
Text18.Text = "" & RS3!开始时间
Text17.Text = "" & RS3!结束时间
Text16.Text = "" & RS3!主办单位
End If
End If
End Sub
Private Sub List3_Click()
RS3.Move List3.ListIndex, adBookmarkFirst
Display3
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
Select Case SSTab1.Tab
Case 0
List1.Enabled = True
CmdAdd.Enabled = True
CmdSave.Enabled = False
CmdCancel.Enabled = False
Case 1
List1.Enabled = False
If List1.ListIndex > -1 Then
CmdAdd.Enabled = True
If List2.ListIndex > -1 Then
CmdMdi.Enabled = True
CmdDel.Enabled = True
CmdSave.Enabled = False
CmdCancel.Enabled = False
Else
CmdMdi.Enabled = False
CmdDel.Enabled = False
CmdSave.Enabled = False
CmdCancel.Enabled = False
End If
End If
Case 2
List1.Enabled = False
If List1.ListIndex > -1 Then
CmdAdd.Enabled = True
If List3.ListIndex > -1 Then
CmdMdi.Enabled = True
CmdDel.Enabled = True
CmdSave.Enabled = False
CmdCancel.Enabled = False
Else
CmdMdi.Enabled = False
CmdDel.Enabled = False
CmdSave.Enabled = False
CmdCancel.Enabled = False
End If
End If
End Select
If ComBm.ListIndex = -1 Then
CmdAdd.Enabled = False
Else
CmdAdd.Enabled = True
End If
CmdMdi.Enabled = False
CmdDel.Enabled = False
CmdSave.Enabled = False
CmdCancel.Enabled = False
For Each ctl In Controls
If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Or TypeOf ctl Is MaskEdBox Then
ctl.Enabled = False
End If
Next ctl
ComBm.Enabled = True
End Sub
Private Sub Text19_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -