📄 frmregme.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmRegMe
BorderStyle = 1 'Fixed Single
Caption = "创建员工账号"
ClientHeight = 4410
ClientLeft = 45
ClientTop = 330
ClientWidth = 4065
Icon = "FrmRegMe.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4410
ScaleWidth = 4065
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox TxtName
Height = 375
Left = 1200
TabIndex = 17
Top = 600
Width = 2415
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 840
Top = 4680
Width = 1455
_ExtentX = 2566
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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.TextBox repassword
Height = 375
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 16
Top = 1560
Width = 2415
End
Begin VB.ComboBox ComboShenFen
Height = 300
Left = 1200
TabIndex = 14
Text = " 请选择员工身份..."
Top = 2400
Width = 2415
End
Begin VB.OptionButton OptionFemail
Caption = "女"
Height = 255
Left = 2400
TabIndex = 13
Top = 2040
Width = 615
End
Begin VB.OptionButton OptionMan
Caption = "男"
Height = 255
Left = 1560
TabIndex = 12
Top = 2040
Value = -1 'True
Width = 615
End
Begin VB.CommandButton CmdClose
Caption = "关闭(&C)"
Height = 375
Left = 2400
TabIndex = 10
Top = 3840
Width = 1095
End
Begin VB.CommandButton CmdRegMe
Caption = "创建(&D)"
Height = 375
Left = 720
TabIndex = 9
Top = 3840
Width = 1095
End
Begin VB.TextBox TxtTel
Height = 375
Left = 1200
TabIndex = 8
Top = 3240
Width = 2415
End
Begin VB.TextBox TxtUMail
Height = 375
Left = 1200
TabIndex = 7
Top = 2760
Width = 2415
End
Begin VB.TextBox TxtPassword
Height = 390
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 6
Top = 1080
Width = 2415
End
Begin VB.TextBox TxtCard
Height = 375
Left = 1200
TabIndex = 5
Top = 120
Width = 2415
End
Begin VB.Label Label8
Caption = "姓 名:"
Height = 255
Left = 480
TabIndex = 18
Top = 720
Width = 735
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "确认密码:"
Height = 375
Left = 240
TabIndex = 15
Top = 1680
Width = 1095
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "身 份:"
Height = 255
Left = 480
TabIndex = 11
Top = 2520
Width = 735
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "电 话:"
Height = 255
Left = 480
TabIndex = 4
Top = 3360
Width = 735
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "E-Mail:"
Height = 255
Left = 480
TabIndex = 3
Top = 2880
Width = 735
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "性 别:"
Height = 255
Left = 480
TabIndex = 2
Top = 2040
Width = 855
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密 码:"
Height = 255
Left = 480
TabIndex = 1
Top = 1200
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "帐 号:"
Height = 255
Left = 480
TabIndex = 0
Top = 240
Width = 855
End
End
Attribute VB_Name = "FrmRegMe"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdClose_Click()
Unload Me
End Sub
Private Sub CmdRegMe_Click()
Dim sql As String
Dim rs_add As New ADODB.Recordset
Dim conn As New ADODB.Connection
conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\database\yh8888.mdb"
If Trim(TxtCard.Text) = "" Then
MsgBox "用户名不能为空,请输入!", vbOKOnly + vbExclamation, ""
TxtCard.SetFocus
Else
sql = "select * from admin"
rs_add.Open sql, conn, adOpenKeyset, adLockPessimistic
While (rs_add.EOF = False)
If Trim(rs_add.Fields(0)) = Trim(TxtCard.Text) Then
MsgBox "已有这个用户", vbOKOnly + vbExclamation, ""
TxtCard.SetFocus
TxtCard.Text = ""
TxtPassword.Text = ""
repassword.Text = ""
ComboShenFen.Text = ""
TxtUMail.Text = ""
TxtTel.Text = ""
Exit Sub
Else
rs_add.MoveNext
End If
Wend
If Trim(TxtPassword.Text) <> Trim(repassword.Text) Then
MsgBox "两次密码不一致", vbOKOnly + vbExclamation, ""
TxtPassword.SetFocus
TxtPassword.Text = ""
repassword.Text = ""
Exit Sub
Else
rs_add.AddNew
rs_add.Fields(0) = TxtCard.Text
rs_add.Fields(1) = TxtName.Text
rs_add.Fields(2) = TxtPassword.Text
If OptionMan.Value Then
rs_add.Fields(4) = "男"
Else
rs_add.Fields(4) = "女"
End If
rs_add.Fields(3) = ComboShenFen.Text
rs_add.Fields(5) = TxtUMail.Text
rs_add.Fields(6) = TxtTel.Text
rs_add.Fields(7) = Now()
rs_add.Update
MsgBox "添加用户成功!", vbOKOnly + vbExclamation, ""
Me.Hide
End If
End If
End Sub
Private Sub Form_Load()
Dim dbName As String
Dim connSTR As String
On Error GoTo errEnd
dbName = App.Path
If Right(dbName, 1) <> "\" Then dbName = dbName + "\"
dbName = dbName + "DataBase\yh8888.mdb"
connSTR = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbName & ";Persist Security Info=False"
Adodc1.ConnectionString = connSTR
ComboShenFen.AddItem "管理员"
ComboShenFen.AddItem "业务员"
Exit Sub
errEnd:
MsgBox Err.Description, vbOKOnly + vbExclamation, "打开数据库出错"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -