📄 main_rsbd_yglz.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form main_rsbd_yglz
BackColor = &H00D0E8EE&
BorderStyle = 1 'Fixed Single
Caption = "员工离职信息录入窗口"
ClientHeight = 3690
ClientLeft = 45
ClientTop = 330
ClientWidth = 6495
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3690
ScaleWidth = 6495
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton CmdSave
BackColor = &H00FFC0C0&
Caption = "保存"
Height = 390
Left = 3075
Style = 1 'Graphical
TabIndex = 9
Top = 3195
Width = 1650
End
Begin VB.CommandButton CmdEnd
BackColor = &H00FFC0C0&
Caption = "返回"
Height = 390
Left = 4770
Style = 1 'Graphical
TabIndex = 8
Top = 3195
Width = 1650
End
Begin VB.Frame Frame1
BackColor = &H00D0E8EE&
Height = 2520
Left = 105
TabIndex = 0
Top = 585
Width = 6330
Begin MSComCtl2.DTPicker DTP1
Height = 330
Left = 1110
TabIndex = 10
Top = 1395
Width = 2955
_ExtentX = 5212
_ExtentY = 582
_Version = 393216
Format = 64487425
CurrentDate = 38125
End
Begin VB.TextBox Text1
Height = 330
Index = 4
Left = 1110
ScrollBars = 1 'Horizontal
TabIndex = 7
Top = 1935
Width = 5070
End
Begin VB.TextBox Text1
Height = 330
Index = 3
Left = 4065
Locked = -1 'True
TabIndex = 6
Top = 885
Width = 2130
End
Begin VB.TextBox Text1
Height = 330
Index = 2
Left = 1110
Locked = -1 'True
TabIndex = 5
Top = 885
Width = 1860
End
Begin VB.TextBox Text1
Height = 330
Index = 1
Left = 4065
Locked = -1 'True
TabIndex = 4
Top = 315
Width = 2115
End
Begin MSDataListLib.DataCombo DataCombo1
Bindings = "main_rsbd_yglz.frx":0000
Height = 330
Left = 1110
TabIndex = 3
Top = 300
Width = 1845
_ExtentX = 3254
_ExtentY = 582
_Version = 393216
ListField = "工号"
Text = ""
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "备 注:"
Height = 225
Left = 195
TabIndex = 11
Top = 1995
Width = 930
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "离职日期: "
Height = 225
Left = 195
TabIndex = 2
Top = 1455
Width = 930
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = $"main_rsbd_yglz.frx":0015
Height = 840
Left = 195
TabIndex = 1
Top = 405
Width = 4380
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 0
Top = 0
Visible = 0 'False
Width = 1335
_ExtentX = 2355
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label10
Appearance = 0 'Flat
BackColor = &H00FFC0C0&
BorderStyle = 1 'Fixed Single
Caption = " 员工离职信息录入"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C000C0&
Height = 375
Left = 1695
TabIndex = 12
Top = 120
Width = 3270
End
End
Attribute VB_Name = "main_rsbd_yglz"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Private Sub DataCombo1_Change()
rs1.Open "select * from 人事档案信息表 where 工号='" + DataCombo1.Text + "'", Cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
Text1(1).Text = rs1.Fields("姓名")
Text1(2).Text = rs1.Fields("部门名称")
Text1(3).Text = rs1.Fields("性别")
End If
rs1.Close
End Sub
Private Sub DataCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTP1.SetFocus
End Sub
Private Sub Form_Activate()
DataCombo1.SetFocus
Adodc1.ConnectionString = Cnn
Adodc1.RecordSource = "select * from 人事档案信息表"
Adodc1.Refresh
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTP1.SetFocus
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If Index < 4 And KeyCode = vbKeyReturn Then Text1(Index + 1).SetFocus
If Index = 4 And KeyCode = vbKeyReturn Then CmdSave.SetFocus
End Sub
Private Sub DTP1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text1(4).SetFocus
End Sub
Private Sub CmdSave_Click()
rs1.Open "select * from 离职信息表", Cnn, adOpenKeyset, adLockOptimistic
rs1.AddNew
rs1.Fields("工号") = DataCombo1.Text
For i = 1 To 3
rs1.Fields(i) = Text1(i).Text
Next i
rs1.Fields("是否离职") = "离职"
rs1.Fields("离职日期") = DTP1.Value
rs1.Fields("备注") = Text1(4).Text
rs1.Update
rs2.Open "select * from 人事档案信息表 where 工号='" + DataCombo1.Text + "'", Cnn, adOpenKeyset, adLockOptimistic
If rs2.RecordCount > 0 Then
rs2.Fields("员工状态") = "离职"
rs2.Update
End If
main_rsbd.Adodc2.Refresh
main_rsbd.Adodc1.Refresh
'关闭数据集对象
rs1.Close
rs2.Close
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
frm_main.Enabled = True
End Sub
Private Sub CmdEnd_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -