📄 员工信息.frm
字号:
TabIndex = 16
Top = 795
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 6
Left = 5040
TabIndex = 15
Top = 795
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 5
Left = 3240
TabIndex = 14
Top = 795
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 4
Left = 1320
TabIndex = 13
Top = 795
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 3
Left = 6840
TabIndex = 12
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 2
Left = 5040
TabIndex = 11
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 1
Left = 3240
TabIndex = 10
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 0
Left = 1320
TabIndex = 5
Top = 360
Width = 855
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "缺勤天数"
Height = 180
Left = 6000
TabIndex = 9
Top = 840
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "出勤天数"
Height = 180
Left = 4200
TabIndex = 8
Top = 840
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "军 烈 属"
Height = 180
Left = 2400
TabIndex = 7
Top = 840
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "生 日"
Height = 180
Left = 360
TabIndex = 6
Top = 840
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "科 室"
Height = 180
Left = 4200
TabIndex = 4
Top = 405
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "职 务"
Height = 180
Left = 6000
TabIndex = 3
Top = 405
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "政治面貌"
Height = 180
Left = 2400
TabIndex = 2
Top = 405
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "姓 名"
Height = 180
Left = 360
TabIndex = 1
Top = 405
Width = 720
End
End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim mysql As String
Dim a, i, msg, j, m As Integer
Private Sub Command2_Click(Index As Integer)
Select Case Index
Case 0 '第一条记录
rst.MoveFirst
Command2(0).Enabled = False
Command2(1).Enabled = False
Command2(2).Enabled = True
Command2(3).Enabled = True
Case 1 '上一条记录
rst.MovePrevious '上一条
If rst.BOF Then
MsgBox "已经没有上一条记录了", 48, "警告"
rst.MoveFirst
Command2(0).Enabled = False
Command2(1).Enabled = False
Command2(2).Enabled = True
Command2(3).Enabled = True
End If
Command2(2).Enabled = True
Command2(3).Enabled = True
Case 2 '下一条记录
rst.MoveNext
If rst.EOF Then
MsgBox "已经没有最后一条记录了", 48, "警告"
Command2_Click (3)
rst.MoveLast
Command2(2).Enabled = False
Command2(3).Enabled = False
Command2(1).Enabled = True
Command2(0).Enabled = True
End If
Command2(1).Enabled = True
Command2(0).Enabled = True
Case 3 '末尾一条记录
rst.MoveLast
Command2(2).Enabled = False
Command2(3).Enabled = False
Command2(1).Enabled = True
Command2(0).Enabled = True
Case 4
For i = 0 To a - 1
Text1(i).Enabled = True
Next i
Case 5
Form9.Show 1
Case 6
Me.Hide '关闭
Case 7
msg = MsgBox("您确定删除该员工信息吗?", vbOKCancel, "警告")
If msg = 1 Then
rst.Delete
rst.MoveNext
End If
End Select
Text1(0).Text = IIf(IsNull(rst.Fields("姓名").Value), "", rst.Fields("姓名").Value) '填充记录
Text1(1).Text = IIf(IsNull(rst.Fields("政治面貌").Value), "", rst.Fields("政治面貌").Value) '填充记录
Text1(2).Text = IIf(IsNull(rst.Fields("职务").Value), "", rst.Fields("职务").Value) '填充记录
Text1(3).Text = IIf(IsNull(rst.Fields("科室").Value), "", rst.Fields("科室").Value) '填充记录
Text1(4).Text = IIf(IsNull(rst.Fields("生日").Value), "", rst.Fields("生日").Value) '填充记录
Text1(5).Text = IIf(IsNull(rst.Fields("军烈属").Value), "", rst.Fields("军烈属").Value) '填充记录
Text1(6).Text = IIf(IsNull(rst.Fields("出勤天数").Value), "", rst.Fields("出勤天数").Value) '填充记录
Text1(7).Text = IIf(IsNull(rst.Fields("缺勤天数").Value), "", rst.Fields("缺勤天数").Value) '填充记录
Text1(8).Text = IIf(IsNull(rst.Fields("基本工资").Value), "", rst.Fields("基本工资").Value) '填充记录
Text1(9).Text = IIf(IsNull(rst.Fields("奖金").Value), "", rst.Fields("奖金").Value) '填充记录
Text1(10).Text = IIf(IsNull(rst.Fields("津贴").Value), "", rst.Fields("津贴").Value) '填充记录
Text1(11).Text = IIf(IsNull(rst.Fields("洗理").Value), "", rst.Fields("洗理").Value) '填充记录
Text1(12).Text = IIf(IsNull(rst.Fields("书报").Value), "", rst.Fields("书报").Value) '填充记录
Text1(13).Text = IIf(IsNull(rst.Fields("交通").Value), "", rst.Fields("交通").Value) '填充记录
Text1(14).Text = IIf(IsNull(rst.Fields("工资扣").Value), "", rst.Fields("工资扣").Value) '填充记录
Text1(15).Text = Val(Text1(8).Text) + Val(Text1(9).Text) + Val(Text1(10).Text) + Val(Text1(11).Text) + Val(Text1(12).Text) + Val(Text1(13).Text)
Text1(16).Text = Text1(14).Text
Text1(17).Text = Val(Text1(15).Text) - Val(Text1(16).Text)
End Sub
Private Sub Form_Load()
Set con = New ADODB.Connection
a = Text1.Count
con.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=gzgl.mdb;persist security info=false"
con.CursorLocation = adUseClient
con.Open
rst.Open "select * from 员工信息,工资总 where 员工信息.ID=工资总.ID", con, adOpenKeyset, adLockOptimistic
If rst.BOF = True Or rst.EOF Then
MsgBox "数据库是空的!"
Else
Text1(0).Text = rst.Fields("姓名").Value
Text1(1).Text = rst.Fields("政治面貌").Value
Text1(2).Text = rst.Fields("职务").Value
Text1(3).Text = rst.Fields("科室").Value
Text1(4).Text = rst.Fields("生日").Value
Text1(5).Text = rst.Fields("军烈属").Value
Text1(6).Text = rst.Fields("出勤天数").Value
Text1(7).Text = rst.Fields("缺勤天数").Value
Text1(8).Text = rst.Fields("基本工资").Value
Text1(9).Text = rst.Fields("奖金").Value
Text1(10).Text = rst.Fields("津贴").Value
Text1(11).Text = rst.Fields("洗理").Value
Text1(12).Text = rst.Fields("书报").Value
Text1(13).Text = rst.Fields("交通").Value
Text1(14).Text = rst.Fields("工资扣").Value
Text1(15).Text = Val(Text1(8).Text) + Val(Text1(9).Text) + Val(Text1(10).Text) + Val(Text1(11).Text) + Val(Text1(12).Text) + Val(Text1(13).Text)
Text1(16).Text = Text1(14).Text
Text1(17).Text = Val(Text1(15).Text) - Val(Text1(16).Text)
End If
For i = 0 To a - 1
Text1(i).Enabled = False
Next i
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
msg = MsgBox("您确定修改该员工的信息吗?", vbOKCancel, "提示")
If msg = 1 Then
If Not (rst.EOF) Then
rst.Fields("姓名").Value = CStr(Text1(0).Text)
rst.Fields("政治面貌").Value = CStr(Text1(1).Text)
rst.Fields("职务").Value = CStr(Text1(2).Text)
rst.Fields("科室").Value = CStr(Text1(3).Text)
rst.Fields("生日").Value = CStr(Text1(4).Text)
rst.Fields("军烈属").Value = CStr(Text1(5).Text)
rst.Fields("出勤天数").Value = CStr(Text1(6).Text)
rst.Fields("缺勤天数").Value = CStr(Text1(7).Text)
rst.Fields("基本工资").Value = CStr(Text1(8).Text)
rst.Fields("奖金").Value = CStr(Text1(9).Text)
rst.Fields("津贴").Value = CStr(Text1(10).Text)
rst.Fields("洗理").Value = CStr(Text1(11).Text)
rst.Fields("书报").Value = CStr(Text1(12).Text)
rst.Fields("交通").Value = CStr(Text1(13).Text)
rst.Fields("工资扣").Value = CStr(Text1(14).Text)
Text1(15).Text = Val(Text1(8).Text) + Val(Text1(9).Text) + Val(Text1(10).Text) + Val(Text1(11).Text) + Val(Text1(12).Text) + Val(Text1(13).Text)
Text1(16).Text = Text1(14).Text
Text1(17).Text = Val(Text1(15).Text) - Val(Text1(16).Text)
End If
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -