📄 frmsystemadd.frm
字号:
VERSION 5.00
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Begin VB.Form frmSystemAdd
BorderStyle = 3 'Fixed Dialog
Caption = "添加用户"
ClientHeight = 2190
ClientLeft = 45
ClientTop = 330
ClientWidth = 4125
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2190
ScaleWidth = 4125
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin CSCommand.Command cmdAdd
Default = -1 'True
Height = 255
Left = 1680
TabIndex = 8
Top = 1800
Width = 855
_ExtentX = 1508
_ExtentY = 450
IconAlign = 0
Icon = "frmSystemAdd.frx":0000
Caption = "添加(&A)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.TextBox txtRpwd
Height = 270
IMEMode = 3 'DISABLE
Left = 2520
MaxLength = 15
PasswordChar = "*"
TabIndex = 3
Top = 1320
Width = 1215
End
Begin VB.TextBox txtPwd
Height = 270
IMEMode = 3 'DISABLE
Left = 2520
MaxLength = 15
PasswordChar = "*"
TabIndex = 2
ToolTipText = "请输入15位以下的密码"
Top = 960
Width = 1215
End
Begin VB.ComboBox cmbType
Height = 300
ItemData = "frmSystemAdd.frx":001C
Left = 2520
List = "frmSystemAdd.frx":001E
TabIndex = 1
Top = 600
Width = 1215
End
Begin VB.TextBox txtUser
Height = 270
Left = 2520
MaxLength = 5
TabIndex = 0
Top = 240
Width = 1215
End
Begin CSCommand.Command cmdBack
Cancel = -1 'True
Height = 255
Left = 2880
TabIndex = 9
Top = 1800
Width = 855
_ExtentX = 1508
_ExtentY = 450
IconAlign = 0
Icon = "frmSystemAdd.frx":0020
Caption = "返回(Ese)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label1
Caption = "添加用户"
BeginProperty Font
Name = "宋体"
Size = 21.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1815
Left = 240
TabIndex = 10
Top = 120
Width = 735
End
Begin VB.Label lbal
Caption = "级 别:"
Height = 195
Index = 3
Left = 1560
TabIndex = 7
Top = 600
Width = 735
End
Begin VB.Label lbal
Caption = "密码确认:"
Height = 195
Index = 2
Left = 1560
TabIndex = 6
Top = 1320
Width = 975
End
Begin VB.Label lbal
Caption = "密 码:"
Height = 195
Index = 1
Left = 1560
TabIndex = 5
Top = 960
Width = 735
End
Begin VB.Label lbal
Caption = "操作员:"
Height = 195
Index = 0
Left = 1560
TabIndex = 4
Top = 240
Width = 735
End
End
Attribute VB_Name = "frmSystemAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim adminStr As String
Private Sub cmdAdd_Click()
If txtUser.Text = "" Then '用户名不能置空约束
MsgBox "操作员名不能为空"
txtUser.SetFocus
Exit Sub
End If
adminStr = "select * from administrator "
If mdlCon.connectTotable(con, rs, adminStr) Then
End If
If rs.EOF And rs.BOF Then
AddUser
Else
If rs!admin = txtUser.Text Then
MsgBox "此用户已存在!请核对员工编号后重新输入!"
With txtUser
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With
Exit Sub
Else
AddUser
End If
End If
End Sub
Private Sub cmdBack_Click()
Unload Me
End Sub
Private Sub Form_Activate()
txtUser.SetFocus
End Sub
Private Sub Form_Load()
If mdlCon.userType = "领班" Then
cmbType.AddItem ("操作员")
cmbType.AddItem ("领班")
Else:
cmbType.AddItem ("经理")
cmbType.AddItem ("操作员")
cmbType.AddItem ("领班")
End If
cmbType.ListIndex = 0
End Sub
Private Sub txtPwd_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = "%" Or Chr(KeyAscii) = "'" Or Chr(KeyAscii) = "*" Then
KeyAscii = 0
End If
End Sub
Private Sub txtRpwd_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = "%" Or Chr(KeyAscii) = "'" Or Chr(KeyAscii) = "*" Then
KeyAscii = 0
End If
End Sub
Sub AddUser()
If txtPwd.Text = "" Or txtRpwd.Text = "" Then
If MsgBox("不为该操作员设密码了吗?", vbInformation + vbYesNo, "添加操作员") = vbNo Then
rs.AddNew
rs!admin = txtUser.Text
rs!ad_pwd = "111111"
rs!ad_type = cmbType.Text
rs.Update
rs.Close
con.Close
MsgBox "操作员添加成功,窗口关闭!默认密码<111111>", vbOKOnly, "操作员添加"
Unload Me
Else
txtPwd.SetFocus
Exit Sub
End If
Else
If txtPwd.Text <> txtRpwd.Text Then
MsgBox "输入的两次密码不同,请重新输入"
txtPwd.Text = ""
txtRpwd.Text = ""
txtPwd.SetFocus
Else
rs.AddNew
rs!admin = txtUser.Text
rs!ad_pwd = txtPwd.Text
rs!ad_type = cmbType.Text
rs.Update
rs.Close
con.Close
MsgBox "操作员添加成功,窗口关闭!", vbOKOnly, "操作员添加"
Unload Me
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -