📄 tianjiamove.frm
字号:
VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form tianjiamove
BorderStyle = 1 'Fixed Single
Caption = "添加调动"
ClientHeight = 4830
ClientLeft = 45
ClientTop = 450
ClientWidth = 7035
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4830
ScaleWidth = 7035
Begin VB.PictureBox Picture1
Height = 4335
Left = 240
ScaleHeight = 4275
ScaleWidth = 6315
TabIndex = 0
Top = 120
Width = 6375
Begin VB.CommandButton Command2
Caption = "返回"
Height = 375
Left = 4200
TabIndex = 18
Top = 3600
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Left = 2760
TabIndex = 17
Top = 3600
Width = 1095
End
Begin MSComCtl2.DTPicker DTPicker2
Height = 375
Left = 4200
TabIndex = 16
Top = 2880
Width = 1215
_ExtentX = 2143
_ExtentY = 661
_Version = 393216
Format = 62717953
CurrentDate = 38851
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 1080
TabIndex = 15
Top = 2880
Width = 1215
_ExtentX = 2143
_ExtentY = 661
_Version = 393216
Format = 62717953
CurrentDate = 38851
End
Begin MSDataListLib.DataCombo DataCombo3
Height = 330
Left = 4200
TabIndex = 14
Top = 2040
Width = 1215
_ExtentX = 2143
_ExtentY = 582
_Version = 393216
Text = ""
End
Begin VB.TextBox Text3
Height = 375
Left = 1080
TabIndex = 13
Top = 2040
Width = 1335
End
Begin MSDataListLib.DataCombo DataCombo2
Height = 330
Left = 4200
TabIndex = 12
Top = 1080
Width = 1215
_ExtentX = 2143
_ExtentY = 582
_Version = 393216
Text = ""
End
Begin VB.TextBox Text2
Height = 375
Left = 1080
TabIndex = 11
Top = 1080
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
Left = 4200
TabIndex = 10
Top = 120
Width = 1215
End
Begin MSDataListLib.DataCombo DataCombo1
Height = 330
Left = 1080
TabIndex = 9
Top = 120
Width = 1335
_ExtentX = 2355
_ExtentY = 582
_Version = 393216
Text = ""
End
Begin VB.Label Label8
Caption = "调入时间:"
Height = 375
Left = 3120
TabIndex = 8
Top = 2880
Width = 975
End
Begin VB.Label Label7
Caption = "调出时间:"
Height = 375
Left = 120
TabIndex = 7
Top = 3000
Width = 975
End
Begin VB.Label Label6
Caption = "新职务:"
Height = 375
Left = 3120
TabIndex = 6
Top = 2040
Width = 1095
End
Begin VB.Label Label5
Caption = "原职务:"
Height = 375
Left = 120
TabIndex = 5
Top = 2160
Width = 1095
End
Begin VB.Label Label4
Caption = "新部门:"
Height = 375
Left = 3240
TabIndex = 4
Top = 1080
Width = 855
End
Begin VB.Label Label3
Caption = "原部门:"
Height = 255
Left = 120
TabIndex = 3
Top = 1200
Width = 1095
End
Begin VB.Label Label2
Caption = "员工姓名:"
Height = 255
Left = 3240
TabIndex = 2
Top = 240
Width = 1095
End
Begin VB.Label Label1
Caption = "员工编号:"
Height = 375
Left = 120
TabIndex = 1
Top = 240
Width = 1335
End
End
End
Attribute VB_Name = "tianjiamove"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim conn As New ADODB.Connection
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
If rsrecord1.State = adStateOpen Then
rsrecord1.Close
End If
rsrecord1.Open "职工调动信息表", conn, adOpenKeyset, adLockPessimistic, adCmdTable
rsrecord1.AddNew
On Error GoTo ErrSave
Call UpRsValue
rsrecord1.Update
MsgBox "数据已保存", , "保存成功"
rsrecord1.MoveNext
Exit Sub
ErrSave:
Select Case Err.Number
Case -2147217873
MsgBox "员工编号已存在,", vbInformation + vbOKOnly, "输入错误"
rsrecord1.CancelUpdate
Case Else
MsgBox "错误描述:" & Err.Description & vbCrLf & "错误代码:" & Err.Number, vbCritical + vbOKOnly, "非法操作"
Unload Me
End Select
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub DataCombo1_Click(Area As Integer)
Dim conn As New ADODB.Connection
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
'RstName.CursorLocation = adUseClient
If RstName.State = adStateOpen Then
RstName.Close
End If
RstName.Open "select *from 员工档案表 where 员工编号='" & DataCombo1.Text & "'", conn, adOpenKeyset, adLockOptimistic, adCmdText
If RstName.RecordCount >= 1 Then
Text1.Text = RstName.Fields(1).value
Text2.Text = RstName.Fields(16).value
Text3.Text = RstName.Fields(18).value
End If
End Sub
Private Sub txtvalue()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
End Sub
Private Sub UpRsValue()
rsrecord1.Fields(0) = DataCombo1.Text
rsrecord1.Fields(1) = Text1.Text
rsrecord1.Fields(2) = Text2.Text
rsrecord1.Fields(3) = DataCombo2.Text
rsrecord1.Fields(4) = Text3.Text
rsrecord1.Fields(5) = DataCombo3.Text
rsrecord1.Fields(6) = DTPicker1.value
rsrecord1.Fields(7) = DTPicker1.value
End Sub
Private Sub Form_Load()
Dim conn As New ADODB.Connection
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
Call txtvalue
If rscode2.State = adStateClosed Then
rscode2.Open "员工档案表", conn, adOpenKeyset, adLockPessimistic, adCmdTable
End If
Set DataCombo1.RowSource = rscode2
DataCombo1.BoundColumn = "员工编号"
DataCombo1.ListField = "员工编号"
If RsMoveBranch1.State = adStateClosed Then
RsMoveBranch1.Open "部门管理", conn, adOpenKeyset, adLockPessimistic, adCmdTable
End If
Set DataCombo2.RowSource = RsMoveBranch1
DataCombo2.BoundColumn = "部门名称"
DataCombo2.ListField = "部门名称"
If RstMoveTitle1.State = adStateClosed Then
RstMoveTitle1.Open "员工职务表", conn, adOpenKeyset, adLockPessimistic, adCmdTable
End If
Set DataCombo3.RowSource = RstMoveTitle1
DataCombo3.BoundColumn = "员工职务名称"
DataCombo3.ListField = "员工职务名称"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -