📄 formbmzwdj.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form部门职务登记
BackColor = &H00FFC0C0&
Caption = "部门/职务登记"
ClientHeight = 5565
ClientLeft = 3840
ClientTop = 2880
ClientWidth = 7740
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5565
ScaleWidth = 7740
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc2
Height = 495
Left = 360
Top = 5040
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=employer;Data Source=(local)"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=employer;Data Source=(local)"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "employermessege"
Caption = "Adodc2"
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 MSAdodcLib.Adodc Adodc1
Height = 495
Left = 360
Top = 4440
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=employer;Data Source=(local)"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=employer;Data Source=(local)"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "bd"
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.CommandButton Command3
BackColor = &H00FFC0C0&
Caption = "退出"
Height = 495
Left = 5640
Style = 1 'Graphical
TabIndex = 19
Top = 4680
Width = 1335
End
Begin VB.CommandButton Command2
BackColor = &H00FFC0C0&
Caption = "清空"
Height = 495
Left = 4080
Style = 1 'Graphical
TabIndex = 18
Top = 4680
Width = 1215
End
Begin VB.CommandButton Command1
BackColor = &H00FFC0C0&
Caption = "确定"
Default = -1 'True
Height = 495
Left = 2520
Style = 1 'Graphical
TabIndex = 17
Top = 4680
Width = 1215
End
Begin VB.Frame Frame1
BackColor = &H00FFC0C0&
Caption = "部门/职务信息"
Height = 3855
Left = 480
TabIndex = 0
Top = 480
Width = 6735
Begin VB.TextBox Textchangereason
Height = 1335
Left = 3240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 16
TabStop = 0 'False
Top = 2280
Width = 3135
End
Begin VB.TextBox Textchangetype
Height = 375
Left = 4440
TabIndex = 15
Top = 1200
Width = 1935
End
Begin VB.TextBox Textchangetime
Height = 375
Left = 4440
TabIndex = 14
Top = 360
Width = 1935
End
Begin VB.TextBox Textchangeid
Height = 375
Left = 1200
TabIndex = 13
Top = 3240
Width = 1695
End
Begin VB.TextBox Textnowduty
Height = 375
Left = 1200
TabIndex = 12
Top = 2520
Width = 1695
End
Begin VB.TextBox Textbeforeduty
Height = 375
Left = 1200
TabIndex = 11
Top = 1800
Width = 1695
End
Begin VB.TextBox Textname
Height = 375
Left = 1200
TabIndex = 10
Top = 1080
Width = 1695
End
Begin VB.TextBox Textid
Height = 375
Left = 1200
TabIndex = 9
Top = 360
Width = 1695
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "变动原因:"
Height = 735
Left = 3240
TabIndex = 8
Top = 1920
Width = 1575
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "变动类型:"
Height = 495
Left = 3240
TabIndex = 7
Top = 1200
Width = 1095
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "变动时间:"
Height = 615
Left = 3240
TabIndex = 6
Top = 480
Width = 1095
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "变动编号:"
Height = 375
Left = 240
TabIndex = 5
Top = 3360
Width = 975
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "现任职务:"
Height = 375
Left = 240
TabIndex = 4
Top = 2640
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "曾任职务:"
Height = 375
Left = 240
TabIndex = 3
Top = 1920
Width = 975
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "姓 名:"
Height = 375
Left = 240
TabIndex = 2
Top = 1200
Width = 975
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "员工编号:"
Height = 495
Left = 240
TabIndex = 1
Top = 480
Width = 1095
End
End
End
Attribute VB_Name = "Form部门职务登记"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
'判断员工编号是否为空
If Textid.Text = "" Then
MsgBox "员工编号不能为空!", vbOKOnly + vbExclamation, "警告"
Textid.SetFocus
Exit Sub
End If
'查看数据库看是否有此编号的员工存在
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = "select * from employermessege where eid='" & Trim(Textid.Text) & "'"
Adodc2.Refresh
If Adodc2.Recordset.EOF = True Then
MsgBox "此员工不存在,不能进行登记,请先填写正确员工编号!", vbOKOnly + vbExclamation, "警告"
Textid.Text = ""
Textid.SetFocus
Exit Sub
End If
'查看数据库看此编号是否已登记
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from bd where yid='" & Trim(Textid.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF = False Then
MsgBox "此员工已经登记!", vbOKOnly + vbExclamation, "警告"
Textid.Text = ""
Textid.SetFocus
Exit Sub
End If
'查看姓名是否为空
If Textname.Text = "" Then
MsgBox "姓名不能为空!", vbOKOnly + vbExclamation, "警告"
Textname.SetFocus
Exit Sub
End If
'查看曾任职务是否为空
If Textbeforeduty.Text = "" Then
MsgBox "曾任职务不能为空!", vbOKOnly + vbExclamation, "警告"
Textbeforeduty.SetFocus
Exit Sub
End If
'查看现任职务是否为空
If Textnowduty.Text = "" Then
MsgBox "现任职务不能为空!", vbOKOnly + vbExclamation, "警告"
Textnowduty.SetFocus
Exit Sub
End If
'查看变动编号是否为空
If Textchangeid.Text = "" Then
MsgBox "变动编号不能为空!", vbOKOnly + vbExclamation, "警告"
Textchangeid.SetFocus
Exit Sub
End If
'查看变动时间是否为空
If Textchangetime.Text = "" Then
MsgBox "变动时间不能为空!", vbOKOnly + vbExclamation, "警告"
Textchangetime.SetFocus
Exit Sub
End If
'查看变动原因是否为空
If Textchangereason.Text = "" Then
MsgBox "变动原因不能为空!", vbOKOnly + vbExclamation, "警告"
Textchangereason.SetFocus
Exit Sub
End If
'变动原因字数限制
If Len(Textchangereason.Text) > 30 Then
MsgBox "变动原因字数不能多于30个!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
'把各数据输入数据库
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("yid").Value = Trim(Textid.Text)
Adodc1.Recordset.Fields("ename").Value = Trim(Textname.Text)
Adodc1.Recordset.Fields("beforeduty").Value = Trim(Textbeforeduty.Text)
Adodc1.Recordset.Fields("nowduty").Value = Trim(Textnowduty.Text)
Adodc1.Recordset.Fields("changeid").Value = Trim(Textchangeid.Text)
Adodc1.Recordset.Fields("changetime").Value = Trim(Textchangetime.Text)
Adodc1.Recordset.Fields("changetype").Value = Trim(Textchangetype.Text)
Adodc1.Recordset.Fields("changereason").Value = Trim(Textchangereason.Text)
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox "恭喜你,部门/职务登记提交成功!", vbOKOnly + vbExclamation, "提示"
Textid.Text = ""
Textname.Text = ""
Textbeforeduty.Text = ""
Textnowduty.Text = ""
Textchangeid.Text = ""
Textchangetime.Text = ""
Textchangetype.Text = ""
Textchangereason.Text = ""
Form用户管理.Show
Me.Hide
End Sub
Private Sub Command2_Click()
Textid.Text = ""
Textname.Text = ""
Textbeforeduty.Text = ""
Textnowduty.Text = ""
Textchangeid.Text = ""
Textchangetime.Text = ""
Textchangetype.Text = ""
Textchangereason.Text = ""
End Sub
Private Sub Command3_Click()
Form用户管理.Show
Unload Me
End Sub
Private Sub Textchangetime_LostFocus()
'查看时间格式是否正确
If Not IsDate(Textchangetime.Text) Then
MsgBox "变动时间格式错误!(正确格式: 2007-01-13 )", vbOKOnly + vbExclamation, "警告"
Textchangetime.Text = ""
Textchangetime.SetFocus
Exit Sub
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -