📄 frmcheck.frm
字号:
End
Begin VB.PictureBox PicFrame
Height = 255
Index = 3
Left = -74760
ScaleHeight = 195
ScaleWidth = 6435
TabIndex = 11
Top = 5040
Width = 6495
Begin VB.Label LblLable
AutoSize = -1 'True
Caption = "▲注意:基本考勤与其它考勤两标签内容保持完整"
Height = 180
Index = 26
Left = 2520
TabIndex = 15
Top = 30
Width = 3960
End
Begin VB.Label LblLable
AutoSize = -1 'True
Caption = "条"
Height = 180
Index = 25
Left = 1320
TabIndex = 14
Top = 30
Width = 180
End
Begin VB.Label LblLable
AutoSize = -1 'True
Caption = "当前记录共"
Height = 180
Index = 24
Left = 0
TabIndex = 13
Top = 30
Width = 900
End
Begin VB.Label LblCount
AutoSize = -1 'True
Height = 180
Left = 1080
TabIndex = 12
Top = 30
Width = 90
End
End
Begin VB.CommandButton CmdPrint
Caption = "打印(&P)"
Height = 375
Left = 5520
TabIndex = 9
Top = 600
Width = 1215
End
Begin VB.PictureBox PicFrame
Height = 3975
Index = 2
Left = 240
ScaleHeight = 3915
ScaleWidth = 6435
TabIndex = 7
Top = 1080
Width = 6495
Begin VB.PictureBox VSDataCheck
BackColor = &H80000005&
FillStyle = 0 'Solid
ForeColor = &H80000008&
Height = 3885
Left = 0
ScaleHeight = 3825
ScaleWidth = 6435
TabIndex = 8
Top = 0
Width = 6495
End
End
End
Begin VB.PictureBox WinXPCheck
Height = 480
Left = 1920
ScaleHeight = 420
ScaleWidth = 1140
TabIndex = 16
Top = 720
Width = 1200
End
Begin VB.CommandButton CmdRefresh
Caption = "Refresh"
Height = 495
Left = 960
TabIndex = 10
Top = 720
Visible = 0 'False
Width = 1215
End
Begin VB.Timer Tmr
Interval = 6000
Left = 240
Top = 840
End
End
Attribute VB_Name = "FrmCheck"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmbCode_Change()
If RstRecordCheck.State = adStateOpen Then
RstRecordCheck.Close '//关闭记录集
End If
RstRecordCheck.Open "select *from 员工档案 where 员工编号='" & CmbCode.Text & "' ", DBCON, adOpenKeyset, adLockOptimistic, adCmdText
'TxtName.Text = RstRecordCheck.Fields(1).Value '//给文本框赋值
'CmbSex.Text = RstRecordCheck.Fields(2).Value
'TxtTiltle.Text = RstRecordCheck.Fields(18).Value
'TxtBranch.Text = RstRecordCheck.Fields(16).Value
End Sub
Private Sub CmdRefresh_Click()
Set VSDataCheck.DataSource = RsAddCheck.DataSource
End Sub
Private Sub CmdRetrun_Click()
Unload Me
End Sub
Private Sub Tmr_Timer()
Call CmdRefresh_Click '//定时刷新
VSDataCheck.Refresh
End Sub
Private Sub Form_Load()
WinXPCheck.InitSubClassing
Me.Left = Frmmdimain.Width / 5
Me.Top = 0
If RsAddCheck.State = adStateClosed Then
RsAddCheck.Open "考勤信息", DBCON, adOpenKeyset, adLockOptimistic, adCmdTable
End If
If RsAddCheck.RecordCount > 0 Then
Call FormTxtValue1
Else
Call FormTxtValue2
End If
End Sub
Private Sub CmdAdd_Click()
RsAddCheck.AddNew '//在记录集中添加一条新记录
Call FormTxtValue2 '//调用给文本框赋空值的过程
Call TxtState '//调用启用文本框的Enabled属性过程
Call CmdState1 '//调用命令按钮Visible属性为隐藏的过程
If RsRecordCheck.State = adStateClosed Then
RsRecordCheck.Open "员工档案", DBCON, adOpenKeyset, adLockPessimistic, adCmdTable
End If
Set CmbCode.RowSource = RsRecordCheck
CmbCode.BoundColumn = "员工编号"
CmbCode.ListField = "员工编号"
End Sub
Private Sub CmdDel_Click()
If MsgBox("确定要删除吗?", vbInformation + vbYesNo, "删除信息") = vbYes Then
If RsAddCheck.RecordCount <> 0 Then
RsAddCheck.Delete '//删除记录
Call CmdMove_Click
Else
MsgBox "当前没有任何记录", , "删除记录"
Call FormTxtValue2 '//调用给文本框赋空值的过程
End If
End If
End Sub
Private Sub CmdEdit_Click()
Call CmdState1 '//调用命令按钮Visible属性为隐藏的过程
Call TxtState '//调用启用文本框的Enabled属性过程
End Sub
Private Sub CmdMove_Click()
If RsAddCheck.RecordCount <> 0 Then
RsAddCheck.MoveNext '//记录向下移一条
If RsAddCheck.EOF Then
RsAddCheck.MoveFirst '//将记录移到第一行
End If
Call FormTxtValue1 '//调用将记录数据赋给文本框的过程
Else
MsgBox "当前没有任何记录", , "移动记录"
End If
End Sub
Private Sub CmdPrint_Click()
DataRepCheck.Show
End Sub
Private Sub CmdSave_Click()
If Trim(TxtOtherDay.Text) <> Empty Or Trim(TxtLate.Text) <> Empty Or Trim(TxtHlrdayDate.Text) <> Empty Or Trim(TxtOverTime.Text) <> Empty Or Trim(TxtVacetion.Text) <> Empty Or Trim(TxtKuangon.Text) <> Empty Then
Call UpRsValue '//调用更新记录集的过程
On Error GoTo ErrSave
RsAddCheck.Update '//更新记录
Call CmdMove_Click
MsgBox "数据已保存", , "保存成功"
SSTCheck.Tab = 0
Call CmdState2
Call TxtState1
Else
MsgBox "带 * 不能为空,若没有请填数字 0", , "验证失败"
SSTCheck.Tab = 1
End If
Exit Sub
ErrSave:
Select Case Err.Number
Case -2147352571
MsgBox "没选择编号或带 * 内容没填,若没有请输入 0 ", vbInformation + vbOKOnly, "输入错误"
RsAddPay.CancelUpdate
Case Else
MsgBox "错误描述:" & Err.Description & vbCrLf & "错误代码:" & Err.Number, vbCritical + vbOKOnly, "非法操作"
End Select
End Sub
Private Sub FormTxtValue1()
CmbCode.Text = RsAddCheck.Fields(0).Value
TxtName.Text = RsAddCheck.Fields(1).Value
CmbSex.Text = RsAddCheck.Fields(2).Value
TxtTiltle.Text = RsAddCheck.Fields(3).Value
TxtBranch.Text = RsAddCheck.Fields(4).Value
CmbAllDate.Text = RsAddCheck.Fields(5).Value
CmbPDate.Text = RsAddCheck.Fields(6).Value
TxtYear.Text = RsAddCheck.Fields(7).Value
CmbMonth.Text = RsAddCheck.Fields(8).Value
DTPForDate.Value = RsAddCheck.Fields(9).Value
DTPEndDate.Value = RsAddCheck.Fields(10).Value
'DTPForTime.Value = RsAddCheck.Fields(11).Value
'DTPEndTime.Value = RsAddCheck.Fields(12).Value
'CmbLeaveType.Text = RsAddCheck.Fields(13).Value
'TxtShenPi.Text = RsAddCheck.Fields(14).Value
'TxtLeaveReason.Text = RsAddCheck.Fields(15).Value
'TxtOtherDay.Text = RsAddCheck.Fields(16).Value
'TxtOtherReason.Text = RsAddCheck.Fields(17).Value
'TxtLate.Text = RsAddCheck.Fields(18).Value
'TxtOverTime.Text = RsAddCheck.Fields(19).Value
'TxtHlrdayDate.Text = RsAddCheck.Fields(20).Value
'TxtVacetion.Text = RsAddCheck.Fields(21).Value
'TxtKuangon.Text = RsAddCheck.Fields(22).Value
'TxtRemark.Text = RsAddCheck.Fields(23).Value
LblCount.Caption = RsAddCheck.RecordCount
End Sub
Private Sub FormTxtValue2()
CmbCode.Text = Empty
'TxtName.Text = Empty
'CmbSex.Text = Empty
'TxtTitle.Text = Empty
'CmbBranch.Text = Empty
CmbAllDate.Text = Empty
CmbPDate.Text = Empty
TxtYear.Text = Empty
CmbMonth.Text = Empty
DTPForDate.Value = Date
DTPEndDate.Value = Date
DTPForTime.Value = Date
DTPEndTime.Value = Date
CmbLeaveType.Text = Empty
TxtShenPi.Text = Empty
TxtLeaveReason.Text = Empty
TxtOtherDay.Text = Empty
TxtOtherReason.Text = Empty
TxtLate.Text = Empty
TxtOverTime.Text = Empty
TxtHlrdayDate.Text = Empty
TxtVacetion.Text = Empty
TxtKuangon.Text = Empty
TxtRemark.Text = Empty
LblCount.Caption = RsAddCheck.RecordCount
End Sub
Private Sub TxtState()
CmbCode.Enabled = True
'TxtName.Enabled = True
'CmbSex.Enabled = True
'TxtTitle.Enabled = True
'CmbBranch.Enabled = True
CmbAllDate.Enabled = True
CmbPDate.Enabled = True
TxtYear.Enabled = True
CmbMonth.Enabled = True
DTPForDate.Enabled = True
DTPEndDate.Enabled = True
DTPForTime.Enabled = True
DTPEndTime.Enabled = True
CmbLeaveType.Enabled = True
TxtShenPi.Enabled = True
TxtLeaveReason.Enabled = True
TxtOtherDay.Enabled = True
TxtOtherReason.Enabled = True
TxtLate.Enabled = True
TxtOverTime.Enabled = True
TxtHlrdayDate.Enabled = True
TxtVacetion.Enabled = True
TxtKuangon.Enabled = True
TxtRemark.Enabled = True
End Sub
Private Sub TxtState1()
CmbCode.Enabled = False
'TxtName.Enabled = False
'CmbSex.Enabled = False
'TxtTitle.Enabled = False
'CmbBranch.Enabled = False
CmbAllDate.Enabled = False
CmbPDate.Enabled = False
TxtYear.Enabled = False
CmbMonth.Enabled = False
DTPForDate.Enabled = False
DTPEndDate.Enabled = False
DTPForTime.Enabled = False
DTPEndTime.Enabled = False
CmbLeaveType.Enabled = False
TxtShenPi.Enabled = False
TxtLeaveReason.Enabled = False
TxtOtherDay.Enabled = False
TxtOtherReason.Enabled = False
TxtLate.Enabled = False
TxtOverTime.Enabled = False
TxtHlrdayDate.Enabled = False
TxtVacetion.Enabled = False
TxtKuangon.Enabled = False
TxtRemark.Enabled = False
End Sub
Private Sub CmdState1()
CmdAdd.Visible = False
CmdEdit.Visible = False
CmdDel.Visible = False
CmdMove.Visible = False
CmdSave.Visible = True
CmdRetrun.Enabled = False
End Sub
Private Sub CmdState2()
CmdAdd.Visible = True
CmdEdit.Visible = True
CmdDel.Visible = True
CmdMove.Visible = True
CmdSave.Visible = False
CmdRetrun.Enabled = True
End Sub
Private Sub UpRsValue()
RsAddCheck.Fields(0).Value = CmbCode.Text
RsAddCheck.Fields(1).Value = TxtName.Text
RsAddCheck.Fields(2).Value = CmbSex.Text
RsAddCheck.Fields(3).Value = TxtTiltle.Text
RsAddCheck.Fields(4).Value = TxtBranch.Text
RsAddCheck.Fields(5).Value = CmbAllDate.Text
RsAddCheck.Fields(6).Value = CmbPDate.Text
RsAddCheck.Fields(7).Value = TxtYear.Text
RsAddCheck.Fields(8).Value = CmbMonth.Text
RsAddCheck.Fields(9).Value = DTPForDate.Value
RsAddCheck.Fields(10).Value = DTPEndDate.Value
RsAddCheck.Fields(11).Value = DTPForTime.Value
RsAddCheck.Fields(12).Value = DTPEndTime.Value
RsAddCheck.Fields(13).Value = CmbLeaveType.Text
RsAddCheck.Fields(14).Value = TxtShenPi.Text
RsAddCheck.Fields(15).Value = TxtLeaveReason.Text
RsAddCheck.Fields(16).Value = TxtOtherDay.Text
RsAddCheck.Fields(17).Value = TxtOtherReason.Text
RsAddCheck.Fields(18).Value = TxtLate.Text
RsAddCheck.Fields(19).Value = TxtOverTime.Text
RsAddCheck.Fields(20).Value = TxtHlrdayDate.Text
RsAddCheck.Fields(21).Value = TxtVacetion.Text
RsAddCheck.Fields(22).Value = TxtKuangon.Text
RsAddCheck.Fields(23).Value = TxtRemark.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -