📄 frmstaff.frm
字号:
Begin VB.TextBox txtUserID
DataField = "UserId"
Height = 375
Left = 1080
TabIndex = 14
Top = 360
Width = 2175
End
Begin VB.TextBox txtAddress
Height = 375
Left = 8160
TabIndex = 8
Top = 960
Width = 2055
End
Begin VB.TextBox txtTel
Height = 375
Left = 4680
TabIndex = 7
Top = 960
Width = 2055
End
Begin VB.TextBox txtName
Height = 375
Left = 1080
TabIndex = 6
Top = 960
Width = 2175
End
Begin VB.TextBox txtEmail
Height = 375
Left = 11280
TabIndex = 5
Top = 960
Width = 2055
End
Begin VB.CommandButton cmdAdd
Caption = "增加"
Height = 495
Left = 1080
TabIndex = 4
Top = 2350
Width = 1600
End
Begin VB.CommandButton cmdDel
Caption = "删除"
Height = 495
Left = 3920
TabIndex = 3
Top = 2350
Width = 1600
End
Begin VB.CommandButton cmdModi
Caption = "修改"
Height = 495
Left = 6760
TabIndex = 2
Top = 2350
Width = 1600
End
Begin VB.CommandButton cmdUserInquire
Caption = "查询"
Enabled = 0 'False
Height = 495
Left = 9600
TabIndex = 1
Top = 2350
Width = 1600
End
Begin VB.Label Label12
AutoSize = -1 'True
Caption = "登录帐号"
Height = 180
Left = 3480
TabIndex = 29
Top = 480
Width = 720
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "权限设置"
Height = 180
Left = 10440
TabIndex = 25
Top = 480
Width = 720
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "密 码"
Height = 180
Left = 6960
TabIndex = 24
Top = 480
Width = 720
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "其他比例"
Height = 180
Left = 10440
TabIndex = 21
Top = 1800
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "超额提成比例"
Height = 180
Left = 6960
TabIndex = 19
Top = 1800
Width = 1080
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "基本提成比例"
Height = 180
Left = 3480
TabIndex = 17
Top = 1800
Width = 1080
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "身份证号码"
Height = 180
Left = 120
TabIndex = 15
Top = 1800
Width = 900
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "员工编号"
Height = 180
Left = 240
TabIndex = 13
Top = 480
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "家庭住址"
Height = 180
Left = 6960
TabIndex = 12
Top = 1080
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "员工姓名"
Height = 180
Left = 240
TabIndex = 11
Top = 1080
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "E-MAIL"
Height = 180
Left = 10440
TabIndex = 10
Top = 1080
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "联系电话"
Height = 180
Left = 3480
TabIndex = 9
Top = 1080
Width = 720
End
End
End
Attribute VB_Name = "frmstaff"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub ClearData()
txtAddress = ""
txtBasic = ""
txtEmail = ""
txtIdefication = ""
txtLogin = ""
txtName = ""
txtOther = ""
txtOver = ""
txtPassword = ""
txtTel = ""
txtUserID = ""
Combo1.Text = "一般用户"
End Sub
Private Function CheckData() As Boolean
Flag = True
If Trim(txtUserID) = "" Then
MsgBox "请输入员工编号,此编号唯一!", 48, "信息提示"
txtUserID.SetFocus
Flag = False
ElseIf Trim(txtLogin) = "" Then
MsgBox "请输入员工登录帐号!", 48, "信息提示"
txtLogin.SetFocus
Flag = False
ElseIf Trim(txtName) = "" Then
MsgBox "请输入员工姓名!", 48, "信息提示"
txtName.SetFocus
Flag = False
ElseIf IsNumeric(txtIdefication) = False Then
MsgBox "身份证号必须为数字,请重新输入身份证号!", 48, "信息提示"
txtIdefication.SetFocus
Flag = False
ElseIf IsNumeric(txtBasic) = fasle Then
MsgBox "基本提成比例必须为数字,请重新输入基本提成比例!", 48, "信息提示"
txtBasic.SetFocus
Flag = False
ElseIf IsNumeric(txtOver) = False Then
MsgBox "超额提成比例必须为数字,请重新输入超额提成比例!", 48, "信息提示"
txtOver.SetFocus
Flag = False
ElseIf IsNumeric(txtOther) = False Then
MsgBox "其他提成比例必须为数字,请重新输入其他提成比例!", 48, "信息提示"
txtOther.SetFocus
Flag = False
End If
CheckData = Flag
End Function
Private Sub cmdAdd_Click()
On Error GoTo errhandle
If CheckData() = False Then Exit Sub
If Combo1.Text = "高级用户" Then
role = 0
Else
role = 1
End If
dbs.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFile & ";Persist Security Info=False"
sqlstring = "insert into usemanage values('" & txtUserID.Text & "','" & txtLogin.Text & _
"','" & txtName.Text & "','" & txtIdefication.Text & "','" & txtPassword.Text & _
"','" & role & "'," & txtBasic.Text & "," & txtOver.Text & "," & _
txtOther.Text & ",'" & txtAddress.Text & "','" & txtTel.Text & "','" & _
txtEmail.Text & "' )"
dbs.Execute sqlstring
dbs.Close
Adodc1.Refresh
DataGrid1.Refresh
MsgBox "成功填加该员工信息,操作完成!", 48, "信息提示"
Call ClearData
Exit Sub
errhandle:
If Err.Number = -2147467259 Then
MsgBox "员工编号必须唯一,请重新输入员工编号!", 48, "信息提示"
txtUserID.SetFocus
Else
MsgBox "有错误发生,错误编号为:" & Err.Number, 48, "信息提示"
End If
End Sub
Private Sub cmdDel_Click()
If Trim(txtUserID.Text) = "" Then
MsgBox "请选择要删除的员工编号!", 48, "信息提示"
Exit Sub
End If
sqlstring = "delete from usemanage where userid='" & txtUserID.Text & "'"
dbs.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFile & ";Persist Security Info=False"
dbs.Execute sqlstring
dbs.Close
Adodc1.Refresh
MsgBox "成功删除该员工信息,操作完成!", 48, "信息提示"
Call ClearData
End Sub
Private Sub cmdModi_Click()
On Error GoTo errhandle
If CheckData() = False Then Exit Sub
Adodc1.Recordset.Fields("userid") = txtUserID
Adodc1.Recordset.Fields("password") = txtPassword
Adodc1.Recordset.Fields("UserName") = txtLogin '登录帐号
If Combo1.Text = "高级用户" Then
role = 0
Else
role = 1
End If
Adodc1.Recordset.Fields("role") = role
Adodc1.Recordset.Fields("realname") = txtName '真实姓名
Adodc1.Recordset.Fields("tel") = txtTel
Adodc1.Recordset.Fields("address") = txtAddress
Adodc1.Recordset.Fields("email") = txtEmail
Adodc1.Recordset.Fields("Idefication") = txtIdefication
Adodc1.Recordset.Fields("BasicDeduct") = txtBasic
Adodc1.Recordset.Fields("OverDeduct") = txtOver
Adodc1.Recordset.Fields("OtherDeduct") = txtOther
Adodc1.Recordset.Update
MsgBox "成功更新该员工信息,操作完成!", 48, "信息提示"
Call ClearData
Exit Sub
errhandle:
If Err.Number = -2147467259 Then
MsgBox "员工编号必须唯一,请重新输入员工编号!", 48, "信息提示"
txtUserID.SetFocus
Else
MsgBox "有错误发生,错误编号为:" & Err.Number, 48, "信息提示"
End If
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
txtUserID = Adodc1.Recordset.Fields("userid")
txtPassword = Adodc1.Recordset.Fields("password")
txtLogin = Adodc1.Recordset.Fields("UserName") '登录帐号
role = Adodc1.Recordset.Fields("role")
If role = 0 Then
Combo1.Text = "高级用户"
Else
Combo1.Text = "一般用户"
End If
txtName = Adodc1.Recordset.Fields("realname") '真实姓名
txtTel = Adodc1.Recordset.Fields("tel")
txtAddress = Adodc1.Recordset.Fields("address")
txtEmail = Adodc1.Recordset.Fields("email")
txtIdefication = Adodc1.Recordset.Fields("Idefication")
txtBasic = Adodc1.Recordset.Fields("BasicDeduct")
txtOver = Adodc1.Recordset.Fields("OverDeduct")
txtOther = Adodc1.Recordset.Fields("OtherDeduct")
End Sub
Private Sub Form_Load()
Combo1.Text = "一般用户"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFile & ";Persist Security Info=False"
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "Usemanage"
'Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
staffFlag = True '员工信息窗口
End Sub
Private Sub Form_Terminate()
staffFlag = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -