If ra.State = adStateOpen Then
ra.Close
End If
If (Text6.Text = "") Or (Text12.Text = "") Or (Text14.Text = "") Then
MsgBox ("请填写所有信息")
Exit Sub
End If
str1 = Text12.Text
If (IsNumeric(str1) = False) Then
MsgBox ("输入编号格式有错误")
Exit Sub
End If
If str1 > 99999999 Or str1 < 1 Then
MsgBox ("输入编号格式有错误")
Exit Sub
End If
str2 = Text14.Text
If (IsNumeric(str2) = False) Then
MsgBox ("输入工资有错误")
Exit Sub
End If
If str2 > 9999 Or str2 < 400 Then
MsgBox ("输入工资有错误")
Exit Sub
End If
rd.Open "SELECT * FROM 人事 where (编号 = '" & Text12.Text & "') and (姓名 ='" & Text6.Text & "')", db, adOpenStatic, adLockOptimistic
If rd.BOF = True Or rd.EOF = True Then
MsgBox ("输入信息不相符")
Exit Sub
Else: ra.Open "delete FROM 工资 where (编号 = '" & Text12.Text & "') and (姓名 ='" & Text6.Text & "') ", db, adOpenStatic, adLockOptimistic
End If
rb.Open "SELECT * FROM 工资 ", db, adOpenStatic, adLockOptimistic
rb.AddNew
rb("姓名") = Text6.Text
rb("编号") = Text12.Text
rb("工资数额") = Text14.Text
rb("日期") = Year(Date) & "-" & Month(Date) & "-" & Day(Date)
rb.Update
rb.Close
rb.Open "SELECT * FROM 工资 ", db, adOpenStatic, adLockOptimistic
Set MSHFlexGrid1.DataSource = rb
Text6.Text = ""
Text12.Text = ""
Text14.Text = ""
End Sub
Private Sub Command4_Click()
Text6.Text = ""
Text12.Text = ""
Text14.Text = ""
End Sub
Private Sub Command5_Click()
Dim num As Long
If rd.State = adStateOpen Then
rd.Close
End If
If rb.State = adStateOpen Then
rb.Close
End If
If ra.State = adStateOpen Then
ra.Close
End If
If (Text1.Text = "") Or (Text9.Text = "") Or (Text5.Text = "") Or (Text7.Text = "") Or (Combo1.Text = "") Or (Text7.Text = "") Or (Combo1.Text = "") Or (Combo2.Text = "") Or (Combo3.Text = "") Or (Combo4.Text = "") Or (Combo5.Text = "") Or (Combo6.Text = "") Or (Combo7.Text = "") Or (Combo8.Text = "") Or (Combo9.Text = "") Or (Combo10.Text = "") Then
MsgBox ("请填写所有信息")
Exit Sub
End If
str1 = Text7.Text
If (IsNumeric(str1) = False) Then
MsgBox ("输入编号格式有错误")
Exit Sub
End If
If str1 > 99999999 Or str1 < 10000000 Then
MsgBox ("输入编号格式有错误")
Exit Sub
End If
If (Combo8.Text - Combo5.Text) < 19 Then
MsgBox ("您的年龄输入有错误")
Exit Sub
End If
rd.Open "SELECT * FROM 人事 where 编号 = '" & Text7.Text & "'", db, adOpenStatic, adLockOptimistic
If rd.BOF = False Or rd.EOF = False Then
MsgBox ("此编号已存在")
Exit Sub
End If
ra.Open "delete FROM 人事 where (编号 = '" & cnum & "') and (姓名 ='" & cname & "') ", db, adOpenStatic, adLockOptimistic
rb.Open "SELECT * FROM 人事 ", db, adOpenStatic, adLockOptimistic
rb.AddNew
rb("姓名") = Text1.Text
rb("性别") = Combo1.Text
rb("编号") = Text7.Text
rb("学历") = Combo4.Text
rb("部门名称") = Combo3.Text
rb("岗位") = Text9.Text
rb("工作性质") = Combo2.Text
rb("出生日期") = Combo5.Text & "-" & Combo6.Text & "-" & Combo7.Text
rb("工作时间") = Combo8.Text & "-" & Combo9.Text & "-" & Combo10.Text
rb("联系方式") = Text5.Text
rb.Update
rb.Close
Text1.Text = ""
Text5.Text = ""
Text7.Text = ""
Text9.Text = ""
Form2.Text1.Text = ""
Form2.Text2.Text = ""
End Sub
Private Sub Command6_Click()
Dim Y As Long
If rd.State = adStateOpen Then
rd.Close
End If
If (Text6.Text = "") Or (Text12.Text = "") Then
MsgBox ("请填写姓名与编号")
Exit Sub
End If
str1 = Text12.Text
If (IsNumeric(str1) = False) Then
MsgBox ("输入编号格式有错误")
Exit Sub
End If
If str1 > 99999999 Or str1 < 1 Then
MsgBox ("输入编号格式有错误")
Exit Sub
End If
rd.Open "SELECT * FROM 工资 where (编号 = '" & Text12.Text & "') and (姓名 ='" & Text6.Text & "') ", db, adOpenStatic, adLockOptimistic
If rd.BOF = True Or rd.EOF = True Then
MsgBox ("输入信息不相符,不能删除")
Exit Sub
Else: Form5.Show
End If
End Sub
Private Sub data1_Click()
Form3.Show
End Sub
Private Sub data3_Click()
Form2.Show
End Sub
Private Sub data2_Click()
info.Enabled = False
member.Enabled = False
salary.Enabled = False
data1.Enabled = True
Frame1.Visible = False
Frame4.Visible = False
Frame2.Visible = False
End Sub
Private Sub data4_Click()
End
End Sub
Private Sub Form_Load()
info.Enabled = True
member.Enabled = True
salary.Enabled = True
Frame1.Visible = False
Frame4.Visible = True
Frame2.Visible = False
If rd.State = adStateOpen Then
rd.Close
End If
rd.Open "SELECT * FROM 人事表单", db, adOpenStatic, adLockOptimistic
Set MSHFlexGrid4.DataSource = rd
End Sub
Private Sub Form_Unload(Cancel As Integer)
db.Close
End Sub
Private Sub info1_Click()
Frame1.Visible = False
Frame4.Visible = True
Frame2.Visible = False
If rd.State = adStateOpen Then
rd.Close
End If
rd.Open "SELECT * FROM 人事表单", db, adOpenStatic, adLockOptimistic
Set MSHFlexGrid4.DataSource = rd
End Sub
Private Sub info2_Click()
Frame1.Visible = False
Frame4.Visible = True
Frame2.Visible = False
form6.Show
End Sub
Private Sub mem1_Click()
Frame1.Visible = False
Frame4.Visible = False
Frame2.Visible = False
Command1.Visible = False
Form2.Show
Form2.Command3.Visible = True
Form2.Command1.Visible = False
End Sub
Private Sub mem2_Click()
Frame1.Visible = False
Frame4.Visible = False
Frame2.Visible = False
Form2.Show
Form2.Command1.Visible = True
Form2.Command3.Visible = False
End Sub
Private Sub member3_Click()
Frame1.Visible = True
Frame4.Visible = False
Frame2.Visible = False
Command5.Visible = False
Command1.Visible = True
End Sub
Private Sub salary_Click()
Frame1.Visible = False
Frame2.Visible = True
Frame4.Visible = False
If rd.State = adStateOpen Then
rd.Close
End If
rd.Open "SELECT * FROM 工资表单", db, adOpenStatic, adLockOptimistic
Set MSHFlexGrid1.DataSource = rd
End Sub