📄 frmaddddinfo.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form frmAddDDInfo
BorderStyle = 1 'Fixed Single
Caption = "添加员工调动信息"
ClientHeight = 4695
ClientLeft = 45
ClientTop = 330
ClientWidth = 6540
Icon = "frmAddDDInfo.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4695
ScaleWidth = 6540
StartUpPosition = 1 '所有者中心
Begin VB.TextBox txtID
Height = 375
Left = 1320
TabIndex = 20
Top = 240
Width = 1695
End
Begin VB.Frame Frame1
Caption = "备注"
Height = 1335
Left = 120
TabIndex = 15
Top = 2760
Width = 6255
Begin VB.TextBox txtbz
Height = 975
Left = 120
TabIndex = 16
Top = 240
Width = 6015
End
End
Begin VB.TextBox txtXZW
Height = 375
Left = 4560
TabIndex = 10
Top = 1440
Width = 1575
End
Begin VB.TextBox txtYZW
Height = 375
Left = 1320
Locked = -1 'True
TabIndex = 9
Top = 1560
Width = 1695
End
Begin VB.ComboBox cboXBM
Height = 300
Left = 4560
TabIndex = 6
Top = 840
Width = 1575
End
Begin VB.TextBox txtBM
Height = 375
Left = 1320
Locked = -1 'True
TabIndex = 4
Top = 840
Width = 1695
End
Begin VB.TextBox txtName
Height = 375
Left = 4560
Locked = -1 'True
TabIndex = 2
Top = 240
Width = 1575
End
Begin MSComCtl2.DTPicker dtpBT
Height = 270
Left = 1320
TabIndex = 12
Top = 2280
Width = 1695
_ExtentX = 2990
_ExtentY = 476
_Version = 393216
Format = 21364737
CurrentDate = 38074
End
Begin MSComCtl2.DTPicker dtpET
Height = 270
Left = 4560
TabIndex = 13
Top = 2280
Width = 1575
_ExtentX = 2778
_ExtentY = 476
_Version = 393216
Format = 21364737
CurrentDate = 38074
End
Begin MSForms.CommandButton cmdOK
Height = 375
Left = 960
TabIndex = 19
Top = 4200
Width = 1095
Caption = "确定"
PicturePosition = 327683
Size = "1931;661"
Picture = "frmAddDDInfo.frx":0442
FontName = "宋体"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
Begin MSForms.CommandButton cmdExit
Height = 375
Left = 4005
TabIndex = 18
Top = 4200
Width = 1095
Caption = "返回"
PicturePosition = 327683
Size = "1931;661"
FontName = "宋体"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
Begin MSForms.CommandButton cmdClear
Height = 375
Left = 2490
TabIndex = 17
Top = 4200
Width = 1095
Caption = "清空"
PicturePosition = 327683
Size = "1931;661"
Picture = "frmAddDDInfo.frx":07DC
FontName = "宋体"
FontHeight = 180
FontCharSet = 134
FontPitchAndFamily= 34
ParagraphAlign = 3
End
Begin VB.Label Label8
Caption = "调入时间:"
Height = 375
Left = 3480
TabIndex = 14
Top = 2280
Width = 1095
End
Begin VB.Label Label7
Caption = "调出时间:"
Height = 375
Left = 120
TabIndex = 11
Top = 2280
Width = 1095
End
Begin VB.Label Label6
Caption = "新职务:"
Height = 375
Left = 3480
TabIndex = 8
Top = 1560
Width = 975
End
Begin VB.Label Label5
Caption = "原职务:"
Height = 495
Left = 240
TabIndex = 7
Top = 1560
Width = 855
End
Begin VB.Label Label4
Caption = "新部门名称:"
Height = 375
Left = 3480
TabIndex = 5
Top = 960
Width = 1215
End
Begin VB.Label Label3
Caption = "原部门名称:"
Height = 375
Left = 120
TabIndex = 3
Top = 840
Width = 1095
End
Begin VB.Label Label2
Caption = "员工姓名:"
Height = 255
Left = 3480
TabIndex = 1
Top = 240
Width = 975
End
Begin VB.Label Label1
Caption = "员工编号:"
Height = 255
Left = 120
TabIndex = 0
Top = 240
Width = 975
End
End
Attribute VB_Name = "frmAddDDInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdClear_Click()
txtID.Text = ""
txtBM.Text = ""
cboXBM.Text = ""
txtYZW.Text = ""
txtXZW.Text = ""
txtbz.Text = ""
txtName.Text = ""
txtID.SetFocus
End Sub
Private Sub cmdExit_Click()
Hide
End Sub
Private Sub cmdOk_Click()
If fsd = False Then
MsgBox "没有记录"
txtID.SetFocus
Exit Sub
End If
Dim strSql As String
Dim strMsg As String
Dim rs As New ADODB.Recordset
If Trim(cboXBM) = "" Then
MsgBox "请输入新部门!"
cboXBM.SetFocus
Exit Sub
End If
If Trim(txtXZW) = "" Then
MsgBox "请输入新职务!!"
txtXZW.SetFocus
Exit Sub
End If
strSql = "select * from AlterationInfo"
Set rs = ExecuteSQL(strSql, strMsg)
rs.AddNew
rs.Fields("工号") = txtID.Text
rs.Fields("原部门") = txtBM.Text
rs.Fields("新部门") = cboXBM.Text
rs.Fields("原职务") = txtYZW.Text
rs.Fields("新职务") = txtXZW.Text
rs.Fields("备注") = txtbz.Text
rs.Fields("调入时间") = dtpBT.Value
rs.Fields("调出时间") = dtpET.Value
rs.Update
rs.Close
strSql = "update t_br set 部门 ='" & txtBM.Text & "', 职务 ='" & txtXZW.Text & "' where 工号='" & txtID.Text & "'"
Set rs = ExecuteSQL(strSql, strMsg)
MsgBox "调动成功!"
Call cmdClear_Click
End Sub
Private Sub Form_Load()
dtpBT.Value = Now
dtpET.Value = Now
End Sub
Private Sub txtID_Validate(Cancel As Boolean)
If fsd = False Then
MsgBox "没有记录"
End If
End Sub
Private Function fsd() As Boolean
Dim strSql As String
Dim strMsg As String
Dim rs As New ADODB.Recordset
strSql = "select * from t_br where 工号='" & txtID & "'"
Set rs = ExecuteSQL(strSql, strMsg)
If rs.EOF Then
fsd = False
Exit Function
Else
txtBM.Text = rs.Fields("部门")
txtName.Text = rs.Fields("姓名")
If IsNull(rs.Fields("职务")) Then
txtYZW.Text = "无职务"
Else
txtYZW.Text = rs.Fields("职务")
End If
fsd = True
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -