📄 添加.frm
字号:
VERSION 5.00
Begin VB.Form Form9
Caption = "调入新员工"
ClientHeight = 5040
ClientLeft = 60
ClientTop = 345
ClientWidth = 8820
ControlBox = 0 'False
LinkTopic = "Form9"
ScaleHeight = 5040
ScaleWidth = 8820
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "退出"
Height = 495
Left = 4800
TabIndex = 29
Top = 4320
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 495
Left = 2160
TabIndex = 28
Top = 4320
Width = 1215
End
Begin VB.Frame Frame3
Caption = "员工信息"
Height = 1215
Left = 360
TabIndex = 15
Top = 120
Width = 7935
Begin VB.TextBox Text1
Height = 270
Index = 0
Left = 1320
TabIndex = 21
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 1
Left = 3600
TabIndex = 20
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 2
Left = 6120
TabIndex = 19
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 3
Left = 1320
TabIndex = 18
Top = 840
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 4
Left = 3600
TabIndex = 17
Top = 795
Width = 855
End
Begin VB.TextBox Text1
Height = 270
Index = 5
Left = 6120
TabIndex = 16
Top = 840
Width = 855
End
Begin VB.Label Label24
AutoSize = -1 'True
Caption = "姓 名"
Height = 180
Left = 360
TabIndex = 27
Top = 405
Width = 720
End
Begin VB.Label Label23
AutoSize = -1 'True
Caption = "政治面貌"
Height = 180
Left = 2760
TabIndex = 26
Top = 405
Width = 720
End
Begin VB.Label Label22
AutoSize = -1 'True
Caption = "职 务"
Height = 180
Left = 360
TabIndex = 25
Top = 840
Width = 720
End
Begin VB.Label Label21
AutoSize = -1 'True
Caption = "科 室"
Height = 180
Left = 5280
TabIndex = 24
Top = 405
Width = 720
End
Begin VB.Label Label20
AutoSize = -1 'True
Caption = "生 日"
Height = 180
Left = 2760
TabIndex = 23
Top = 840
Width = 720
End
Begin VB.Label Label19
AutoSize = -1 'True
Caption = "军 烈 属"
Height = 180
Left = 5280
TabIndex = 22
Top = 840
Width = 720
End
End
Begin VB.Frame Frame2
Caption = "工资信息"
Height = 2535
Left = 360
TabIndex = 0
Top = 1560
Width = 7935
Begin VB.TextBox Text1
Height = 270
Index = 6
Left = 1440
TabIndex = 7
Top = 600
Width = 1095
End
Begin VB.TextBox Text1
Height = 270
Index = 12
Left = 3600
TabIndex = 6
Top = 1920
Width = 1095
End
Begin VB.TextBox Text1
Height = 270
Index = 7
Left = 3600
TabIndex = 5
Top = 600
Width = 1095
End
Begin VB.TextBox Text1
Height = 270
Index = 11
Left = 6120
TabIndex = 4
Top = 1320
Width = 1095
End
Begin VB.TextBox Text1
Height = 270
Index = 10
Left = 3600
TabIndex = 3
Top = 1320
Width = 1095
End
Begin VB.TextBox Text1
Height = 270
Index = 9
Left = 1440
TabIndex = 2
Top = 1320
Width = 1095
End
Begin VB.TextBox Text1
Height = 270
Index = 8
Left = 6120
TabIndex = 1
Top = 600
Width = 1095
End
Begin VB.Label Label16
AutoSize = -1 'True
Caption = "基本工资"
Height = 180
Left = 600
TabIndex = 14
Top = 645
Width = 720
End
Begin VB.Label Label15
AutoSize = -1 'True
Caption = "奖 金"
Height = 180
Left = 2880
TabIndex = 13
Top = 645
Width = 720
End
Begin VB.Label Label14
AutoSize = -1 'True
Caption = "工资扣款"
Height = 180
Left = 2760
TabIndex = 12
Top = 1965
Width = 720
End
Begin VB.Label Label13
AutoSize = -1 'True
Caption = "津 贴"
Height = 180
Left = 5040
TabIndex = 11
Top = 645
Width = 720
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "洗 理"
Height = 180
Left = 600
TabIndex = 10
Top = 1365
Width = 720
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "书 报"
Height = 180
Left = 2880
TabIndex = 9
Top = 1365
Width = 720
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "交 通"
Height = 180
Left = 5040
TabIndex = 8
Top = 1365
Width = 720
End
End
End
Attribute VB_Name = "Form9"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rst As ADODB.Recordset
Dim con As New ADODB.Connection
Dim j As Integer
Dim nowdate As String
Private Sub Command1_Click()
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=gzgl.mdb;Persist Security Info=False"
con.CursorLocation = adUseClient
con.Open
Set rst = con.Execute("select * from 员工信息,工资总 where 员工信息.编号=工资总.编号")
j = rst.RecordCount
If Text1(0).Text = "" Then
i = MsgBox("这是必填字段!", vbOKCancel, "警告")
If i = 1 Then
Text1(0).SetFocus
Else
Me.Hide
End If
Else
j = j + 1
If Month(Now) > 10 Then
nowdate = Mid(Year(Now), 3, 2) & Month(Now)
Else
nowdate = Mid(Year(Now), 3, 2) & "0" & Month(Now)
End If
con.Execute ("insert into 员工信息 (编号,姓名,政治面貌,科室,职务,生日,军烈属)" _
& " select '" & CStr(j) & "','" & Trim(Text1(0).Text) & "','" & Trim(Text1(1).Text) & "','" & Trim(Text1(2).Text) & "','" & Trim(Text1(3).Text) & "','" & Trim(Text1(4).Text) & "','" & Trim(Text1(5).Text) & "'")
con.Execute ("insert into 工资总 (编号,基本工资,奖金,津贴,洗理,书报,交通,工资扣,日期)" _
& " select '" & CStr(j) & "','" & Val(Trim(Text1(6).Text)) & "','" & Val(Trim(Text1(7).Text)) & "','" & Val(Trim(Text1(8).Text)) & "','" & Val(Trim(Text1(9).Text)) & "','" & Val(Trim(Text1(10).Text)) & "','" & Val(Trim(Text1(11).Text)) & "','" & Val(Trim(Text1(12).Text)) & "','" & Val(nowdate) & "'")
MsgBox "数据添加成功!", vbOKOnly, "恭喜!"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text1(0).Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -