📄 frmwelfare.frm
字号:
VERSION 5.00
Begin VB.Form FrmAddWelfare
BorderStyle = 1 'Fixed Single
Caption = "福利费用"
ClientHeight = 3915
ClientLeft = 1095
ClientTop = 330
ClientWidth = 7620
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 3915
ScaleWidth = 7620
Begin VB.CommandButton cmdExit
Caption = "退出"
Height = 495
Left = 4800
TabIndex = 20
Top = 3120
Width = 1215
End
Begin VB.CommandButton cmdSave
Caption = "保存"
Height = 495
Left = 1920
TabIndex = 19
Top = 3120
Width = 1335
End
Begin VB.Frame Frame2
Caption = "福利费用"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2775
Left = 120
TabIndex = 0
Top = 120
Width = 7335
Begin VB.TextBox txtFields
DataField = "年度"
Height = 285
Index = 0
Left = 1440
TabIndex = 9
Top = 360
Width = 1935
End
Begin VB.TextBox txtFields
DataField = "月份"
Height = 285
Index = 1
Left = 4680
TabIndex = 8
Top = 360
Width = 1935
End
Begin VB.TextBox txtFields
DataField = "部门"
Height = 285
Index = 2
Left = 4680
TabIndex = 7
Top = 1245
Width = 1935
End
Begin VB.TextBox txtFields
DataField = "岗位"
Height = 285
Index = 3
Left = 1440
TabIndex = 6
Top = 1260
Width = 1935
End
Begin VB.TextBox txtFields
DataField = "员工号"
Height = 285
Index = 4
Left = 1440
TabIndex = 5
Top = 810
Width = 1935
End
Begin VB.TextBox txtFields
DataField = "姓名"
Height = 285
Index = 5
Left = 4680
TabIndex = 4
Top = 795
Width = 1935
End
Begin VB.TextBox txtFields
DataField = "费用类型"
Height = 285
Index = 7
Left = 4680
TabIndex = 3
Top = 1680
Width = 1935
End
Begin VB.TextBox txtFields
DataField = "费用项目"
Height = 285
Index = 8
Left = 1440
TabIndex = 2
Top = 2160
Width = 1935
End
Begin VB.TextBox txtFields
DataField = "费用金额"
Height = 285
Index = 9
Left = 1440
TabIndex = 1
Top = 1710
Width = 1935
End
Begin VB.Label lblLabels
Caption = "年度:"
Height = 255
Index = 0
Left = 720
TabIndex = 18
Top = 420
Width = 855
End
Begin VB.Label lblLabels
Caption = "月份:"
Height = 255
Index = 1
Left = 3960
TabIndex = 17
Top = 420
Width = 855
End
Begin VB.Label lblLabels
Caption = "部门:"
Height = 255
Index = 2
Left = 3960
TabIndex = 16
Top = 1320
Width = 855
End
Begin VB.Label lblLabels
Caption = "岗位:"
Height = 255
Index = 3
Left = 720
TabIndex = 15
Top = 1320
Width = 735
End
Begin VB.Label lblLabels
Caption = "员工号:"
Height = 255
Index = 4
Left = 600
TabIndex = 14
Top = 840
Width = 855
End
Begin VB.Label lblLabels
Caption = "姓名:"
Height = 255
Index = 5
Left = 3960
TabIndex = 13
Top = 885
Width = 615
End
Begin VB.Label lblLabels
Caption = "费用类型:"
Height = 255
Index = 7
Left = 3600
TabIndex = 12
Top = 1800
Width = 1095
End
Begin VB.Label lblLabels
Caption = "费用项目:"
Height = 255
Index = 8
Left = 360
TabIndex = 11
Top = 2280
Width = 975
End
Begin VB.Label lblLabels
Caption = "费用金额:"
Height = 255
Index = 9
Left = 360
TabIndex = 10
Top = 1815
Width = 975
End
End
End
Attribute VB_Name = "FrmAddWelfare"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim WithEvents adoPrimaryRS As Recordset
Attribute adoPrimaryRS.VB_VarHelpID = -1
Dim mvBookMark As Variant
Dim mbEditFlag As Boolean
Dim mbAddNewFlag As Boolean
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
Dim adoshowrsJL As ADODB.Recordset
Dim msgstr As String
If txtFields(4).Text <> "" And IsNumeric(txtFields(0).Text) And IsNumeric(txtFields(1).Text) Then
SqlJL = "SELECT * From 福利费用 Where 员工号 ='" & txtFields(3).Text & "' " & " and 年度 = " & txtFields(0).Text & " and 月份 = " & txtFields(1).Text
Else
MsgBox "请输入正确的员工号、年度和月份信息!", vbExclamation + vbOKOnly, "信息框"
Exit Sub
End If
Set adoshowrsJL = ExecuteSQL(SqlJL, msgstr)
'adoshowrsJL.Open SqlJL, db, adOpenStatic, adLockOptimistic
'adoshowrsJL.Requery
If Not adoshowrsJL.BOF And Not adoshowrsJL.EOF Then
MsgBox "此员工的本年月福利费用信息已存在,请输入新的福利费用信息!", vbExclamation + vbOKOnly, "信息框"
Exit Sub
End If
Dim txtSQL As String
Dim mrcc As ADODB.Recordset
txtSQL = "select * from 福利费用"
Set mrcc = ExecuteSQL(txtSQL, msgstr)
mrcc.AddNew
mrcc.Fields(1) = Val(txtFields(0).Text)
mrcc.Fields(2) = Val(txtFields(1).Text)
mrcc.Fields(3) = Trim(txtFields(4).Text)
mrcc.Fields(4) = Trim(txtFields(5).Text)
mrcc.Fields(5) = Trim(txtFields(2).Text)
mrcc.Fields(6) = Val(txtFields(3).Text)
mrcc.Fields(7) = Val(txtFields(7).Text)
mrcc.Fields(8) = Val(txtFields(8).Text)
mrcc.Fields(9) = Val(txtFields(9).Text)
mrcc.Update
MsgBox "福利费用信息添加成功!", vbOKOnly + vbExclamation, "添加福利费用信息"
mrcc.Close
End Sub
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
Private Sub txtFields_LostFocus(Index As Integer)
Dim msgstr As String
If Index = 4 Then
Dim Sql3 As String
Sql3 = "select distinct 部门 ,姓名 ,岗位 from 员工基本信息 where 员工号 = '" & txtFields(4).Text & "'"
Set rs3 = ExecuteSQL(Sql3, msgstr)
If Not rs3.EOF Then
If Not IsNull(rs3("姓名")) Then
txtFields(5).Text = Trim(rs3("姓名"))
End If
If Not IsNull(rs3("部门")) Then
txtFields(2).Text = Trim(rs3("部门"))
End If
If Not IsNull(rs3("岗位")) Then
txtFields(3).Text = Trim(rs3("岗位"))
End If
End If
End If
If Not IsNumeric(txtFields(0).Text) And (txtFields(0).Text <> "") Then
MsgBox "请在“年度”中输入数字", vbExclamation + vbOKOnly, pTitle
txtFields(0).SetFocus
txtFields(0).SelLength = Len(txtFields(0))
txtFields(0).SelStart = 0
End If
If Not IsNumeric(txtFields(1).Text) And (txtFields(1).Text <> "") Then
MsgBox "请在“月份”中输入数字", vbExclamation + vbOKOnly, pTitle
txtFields(1).SetFocus
txtFields(1).SelLength = Len(txtFields(1))
txtFields(1).SelStart = 0
End If
If Not IsNumeric(txtFields(9).Text) And (txtFields(9).Text <> "") Then
MsgBox "请在“费用金额”中输入数字", vbExclamation + vbOKOnly, pTitle
txtFields(9).SetFocus
txtFields(9).SelLength = Len(txtFields(9))
txtFields(9).SelStart = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -