📄 f_ruzhitongzhishu.frm
字号:
Index = 7
Left = 3120
TabIndex = 17
Top = 1080
Width = 615
End
Begin VB.Label lblLabels
Caption = "民族:"
Height = 255
Index = 6
Left = 120
TabIndex = 16
Top = 1080
Width = 615
End
Begin VB.Label lblLabels
Caption = "岗位名称:"
Height = 255
Index = 4
Left = 6120
TabIndex = 15
Top = 720
Width = 855
End
Begin VB.Label lblLabels
Caption = "出生日期:"
Height = 255
Index = 3
Left = 3120
TabIndex = 14
Top = 720
Width = 855
End
Begin VB.Label lblLabels
Caption = "性别:"
Height = 255
Index = 2
Left = 120
TabIndex = 13
Top = 720
Width = 615
End
Begin VB.Label lblLabels
Caption = "姓名:"
Height = 255
Index = 1
Left = 6120
TabIndex = 12
Top = 360
Width = 615
End
Begin VB.Label lblLabels
Caption = "部门:"
Height = 255
Index = 0
Left = 3120
TabIndex = 11
Top = 360
Width = 615
End
End
End
End
End
Attribute VB_Name = "F_RuZhiTongZhiShu"
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 Form_Load()
On Error Resume Next
For Each TextBox In Me.Controls
TextBox.Font.Name = "宋体"
TextBox.Font.Size = 9
Next
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open "select * from 入职通知书", db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = adoPrimaryRS
SetButtons True
Dim oText As TextBox
'Bind the text boxes to the data provider
For Each oText In Me.txtFields
Set oText.DataSource = adoPrimaryRS
Next
Set DTPicker1.DataSource = adoPrimaryRS
Set DTPicker2.DataSource = adoPrimaryRS
Set DTPicker3.DataSource = adoPrimaryRS
Set Combo1.DataSource = adoPrimaryRS
Set Combo2.DataSource = adoPrimaryRS
Combo1.AddItem "是"
Combo1.AddItem "否"
Combo2.AddItem "是"
Combo2.AddItem "否"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
Private Sub cmdAdd_Click()
On Error GoTo AddErr
With adoPrimaryRS
If Not (.BOF And .EOF) Then
mvBookMark = .Bookmark
End If
.AddNew
mbAddNewFlag = True
SetButtons False
End With
Exit Sub
AddErr:
MsgBox "增加操作有错误", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdDelete_Click()
On Error GoTo DeleteErr
With adoPrimaryRS
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
Exit Sub
DeleteErr:
MsgBox "删除操作有错误", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdRefresh_Click()
'This is only needed for multi user apps
On Error GoTo RefreshErr
adoPrimaryRS.Requery
Exit Sub
RefreshErr:
MsgBox "刷新操作有错误", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdEdit_Click()
On Error GoTo EditErr
mbEditFlag = True
SetButtons False
Exit Sub
EditErr:
MsgBox "更改操作有错误", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdCancel_Click()
' On Error Resume Next
On Error GoTo CancelErr
mbEditFlag = False
mbAddNewFlag = False
adoPrimaryRS.CancelUpdate
If mvBookMark > 0 Then
adoPrimaryRS.Bookmark = mvBookMark
Else
adoPrimaryRS.MoveFirst
End If
SetButtons True
Exit Sub
CancelErr:
MsgBox "取消操作有错误", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdUpdate_Click()
On Error GoTo UpdateErr
adoPrimaryRS.UpdateBatch adAffectAll
If mbAddNewFlag Then
adoPrimaryRS.MoveLast 'move to the new record
End If
mbEditFlag = False
mbAddNewFlag = False
SetButtons True
Exit Sub
UpdateErr:
MsgBox "保存操作有错误", vbExclamation + vbOKOnly, pTitle
End Sub
Private Sub cmdClose_Click()
RSGL.Enabled = True
Unload Me
End Sub
Private Sub SetButtons(bVal As Boolean)
Dim oTEX As TextBox
cmdAdd.Visible = bVal
cmdEdit.Visible = bVal
cmdUpdate.Visible = Not bVal
cmdCancel.Visible = Not bVal
cmdDelete.Visible = bVal
cmdClose.Visible = bVal
cmdRefresh.Visible = bVal
If bVal Then
Set DataGrid1.DataSource = adoPrimaryRS
Else
Set DataGrid1.DataSource = Nothing
End If
For Each oText In Me.txtFields
oText.Enabled = Not bVal
Next
Combo1.Enabled = Not bVal
Combo2.Enabled = Not bVal
End Sub
Private Sub txtFields_LostFocus(Index As Integer)
If Index = 3 Then
Dim Sql3 As String
Sql3 = "select distinct 部门 ,姓名 ,性别 ,出生日期 ,岗位,民族 ,身高 ,体重 ,进入公司时间 from 员工基本信息 where 员工号 = '" & txtFields(3).Text & "'"
Set rs3 = db.Execute(Sql3)
If Not rs3.EOF Then
If Not IsNull(rs3("部门")) Then
txtFields(0).Text = Trim(rs3("部门"))
End If
If Not IsNull(rs3("姓名")) Then
txtFields(1).Text = Trim(rs3("姓名"))
End If
If Not IsNull(rs3("性别")) Then
txtFields(2).Text = Trim(rs3("性别"))
End If
If Not IsNull(rs3("出生日期")) Then
DTPicker3.Value = Trim(rs3("出生日期"))
End If
If Not IsNull(rs3("岗位")) Then
txtFields(4).Text = Trim(rs3("岗位"))
End If
If Not IsNull(rs3("民族")) Then
txtFields(6).Text = Trim(rs3("民族"))
End If
If Not IsNull(rs3("身高")) Then
txtFields(7).Text = Trim(rs3("身高"))
End If
If Not IsNull(rs3("体重")) Then
txtFields(8).Text = Trim(rs3("体重"))
End If
'If Not IsNull(rs3("鞋号")) Then
' txtFields(9).Text = Trim(rs3("鞋号"))
'End If
If Not IsNull(rs3("进入公司时间")) Then
DTPicker1.Value = Trim(rs3("进入公司时间"))
End If
End If
End If
If Not IsNumeric(txtFields(7).Text) And (txtFields(7).Text <> "") Then
MsgBox "请在“身高”中输入数字", vbExclamation + vbOKOnly, pTitle
txtFields(7).SetFocus
txtFields(7).SelLength = Len(txtFields(7))
txtFields(7).SelStart = 0
End If
If Not IsNumeric(txtFields(8).Text) And (txtFields(8).Text <> "") Then
MsgBox "请在“体重”中输入数字", vbExclamation + vbOKOnly, pTitle
txtFields(8).SetFocus
txtFields(8).SelLength = Len(txtFields(8))
txtFields(8).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 + -