📄 frm_addattendance.frm
字号:
EndProperty
Height = 225
Index = 6
Left = 3390
TabIndex = 16
Top = 2220
Width = 885
End
Begin VB.Label Label1
Caption = "迟到次数"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Index = 5
Left = 630
TabIndex = 14
Top = 2220
Width = 885
End
Begin VB.Label Label1
Caption = "当前日期"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Index = 2
Left = 1650
TabIndex = 7
Top = 450
Width = 885
End
End
Begin VB.Frame Frame2
Caption = "职工个人信息"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1005
Left = 450
TabIndex = 1
Top = 900
Width = 6465
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 4020
TabIndex = 5
Top = 390
Width = 1665
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1260
TabIndex = 3
Top = 390
Width = 1665
End
Begin VB.Label Label1
Caption = "职工姓名"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Index = 1
Left = 3120
TabIndex = 4
Top = 450
Width = 885
End
Begin VB.Label Label1
Caption = "职工编号"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Index = 0
Left = 360
TabIndex = 2
Top = 450
Width = 885
End
End
Begin VB.Image Image1
Height = 420
Left = 1650
Picture = "Frm_AddAttendance.frx":0000
Top = 390
Width = 3690
End
End
End
Attribute VB_Name = "Frm_AddAttendance"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
''''首先检查输入的正确性''''''''''''
Dim strSql As String
Dim m_Rs As New ADODB.Recordset
Dim IO_Flag As String '''''存储出入标志''''''''''
If Combo1.Text = "" Then
MsgBox "职工编号不能为空...", vbOKOnly + vbExclamation, "警告!"
Exit Sub
End If
''''''定义出入标志**上班为入(I)**下班为出(O)'''''''''
If Option1.Value = True Then
IO_Flag = "I"
End If
If Option2.Value = True Then
IO_Flag = "O"
End If
If iATFlag = 0 Then
If MsgBox("确定是否存盘?", vbYesNo + vbQuestion, "存盘?") = vbYes Then
strSql = "INSERT INTO AttendanceInfo(AStuffID,AStuffName,ADate,AFlag,AInTime,AOutTime,ALate,AEarly) Values('"
strSql = strSql & Trim(Combo1.Text) & "','" & Trim(Text1.Text) & "','" & Trim(CurrentDate.Text) & "','" & Trim(IO_Flag) & "','"
strSql = strSql & Trim(InTime.Text) & "','" & Trim(OutTime) & "'," & Val(Text2.Text) & "," & Val(Text3.Text) & ")"
MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "存盘成功..."
''''''''初始化'''''''''
With Me
Combo1.Text = ""
Text1.Text = ""
''CurrentDate.Text = ""
End With
End If ''if 存盘
End If
''''''修改上下班信息'''''''''''''
If iATFlag = 1 Then
If MsgBox("确定是否修改记录?", vbYesNo + vbQuestion, "修改?") = vbYes Then
strSql = "UPDATE AttendanceInfo Set AStuffName='" & Trim(Text1.Text) & "',ADate='" & Trim(CurrentDate.Text) & "',AInTime='" & Trim(InTime.Text) & "',AoutTime='" & Trim(OutTime.Text) & "',ALate="
strSql = strSql & Val(Trim(Text2.Text)) & ",AEarly=" & Val(Trim(Text3.Text)) & " WHERE AStuffID='" & Trim(sATData(0)) & "'"
''''MsgBox strSql
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "修改成功..."
End If
End If
If iATFlag = 2 Then
'If iAFlag = 2 Then
If MsgBox("确定是否删除此记录?", vbYesNo + vbQuestion, "删除?") = vbYes Then
strSql = "DELETE * FROM AttendanceInfo WHERE AStuffID='" & Trim(Combo1.Text) & "'"
Set m_Rs = ExecuteSQL(strSql, "Person.mdb")
MsgBox "删除成功..."
CurrentDate.Text = Format(Now, "yyyy年mm月dd日")
InTime.Text = Time
OutTime.Text = Time
Text2.Text = "0"
Text3.Text = "0"
End If
End If
End Sub
Private Sub Combo1_Click()
Dim strSql As String
strSql = "SELECT * FROM StuffInfo"
Text1.Text = getFieldValue(strSql, "Person.mdb", "SID", "SName", Trim(Combo1.Text))
End Sub
Private Sub Form_Load()
'''''添加控件信息'''''''''
Dim strSql As String
''''**SID为职工编号的字段名'''''''
''''**SDept为职工所在的部门名称字段名'''''''''
''''**StuffInfo为人事基本信息的表名'''''''''''
''''**Person.mdb为数据库名称''''''''''''''''''
''''**BindToCombo为公共模块的函数在模块AdoConn中
strSql = "SELECT * FROM StuffInfo Order By SID"
BindToCombo strSql, "Person.mdb", "SID", Combo1
'''''''添加缺省日期''''''''''''''''''''''''''''
'''''iATFlag=0为添加记录'''''''''''''''''''
If iATFlag = 0 Then
CurrentDate.Text = Format(Now, "yyyy年mm月dd日")
''InTime.Text = Time
''OutTime.Text = Time
Text2.Text = "0"
Text3.Text = "0"
End If
'''''iATFlag=1为修改记录'''''''''''''
If iATFlag = 1 Then
Combo1.Text = Trim(sATData(0))
Text1.Text = Trim(sATData(1))
CurrentDate = Trim(sATData(2))
InTime.Text = Trim(sATData(4))
OutTime.Text = Trim(sATData(5))
Text2.Text = Trim(sATData(6))
Text3.Text = Trim(sATData(7))
End If
'''''iATFlag=2为删除记录'''''''''''''
If iATFlag = 2 Then
Combo1.Text = Trim(sATData(0))
Text1.Text = Trim(sATData(1))
CurrentDate = Trim(sATData(2))
InTime.Text = Trim(sATData(4))
OutTime.Text = Trim(sATData(5))
Text2.Text = Trim(sATData(6))
Text3.Text = Trim(sATData(7))
End If
''''''''''''''''''''''''''''''''''''''''''''''''
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -