📄 frmadduser.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmAddUser
BackColor = &H00FFFFC0&
Caption = "添加新用户"
ClientHeight = 3825
ClientLeft = 60
ClientTop = 345
ClientWidth = 5385
LinkTopic = "Form1"
ScaleHeight = 3825
ScaleWidth = 5385
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 960
Top = 3600
Visible = 0 'False
Width = 3135
_ExtentX = 5530
_ExtentY = 582
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=Microsoft.Jet.OLEDB.4.0;Data Source=F:\毕业设计\database\企业工资管理系统.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\毕业设计\database\企业工资管理系统.mdb;Persist Security Info=False"
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.ComboBox Combo1
Height = 300
Left = 2280
TabIndex = 9
Text = "Combo1"
Top = 2520
Width = 1815
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 8
Top = 3120
Width = 1215
End
Begin VB.CommandButton cmdOK
Caption = "确认"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 960
TabIndex = 7
Top = 3120
Width = 1215
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 2
Left = 2280
TabIndex = 5
Text = "Text1"
Top = 1800
Width = 1815
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 2280
TabIndex = 4
Text = "Text1"
Top = 1080
Width = 1815
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 2280
TabIndex = 1
Text = "Text1"
Top = 360
Width = 1815
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "用户权限:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 6
Top = 2520
Width = 1215
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "确认密码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 3
Top = 1800
Width = 1215
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "用户密码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 2
Top = 1080
Width = 1215
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "新用户名称:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 0
Top = 360
Width = 1455
End
End
Attribute VB_Name = "frmAddUser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCancel_Click()
Me.Hide
Unload Me
Exit Sub
End Sub
Private Sub cmdOK_Click()
If iflag = False Then
cmdOK = False
End If
Adodc1.Recordset.AddNew
Dim finduser As Boolean
finduser = False
Adodc1.Recordset.MoveFirst '将记录指针移动到首记录
If Trim(Text1(0).Text = "") Then
MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
Text1(0).SetFocus
Exit Sub
Else
'Do While Not Adodc1.Recordset.EOF '判断数据表是否已经读完,即遍历整张表
If Adodc1.Recordset.Fields("用户名称") = Trim(Text1(0).Text) Then 'field就是某个字段
finduser = True
MsgBox "该用户已经存在,请重新输入!", vbOKOnly + vbExclamation, "警告"
Text1(0).SetFocus
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
Exit Sub
Else
If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
MsgBox "两次输入密码不一致!", vbOKOnly + vbExclamation, "警告"
Text1(1).SetFocus
Text1(1).Text = ""
Text1(2).Text = ""
Exit Sub
Else
If Trim(Text1(1).Text) = "" Then
MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
Text1(1).SetFocus
Text1(1).Text = ""
Text1(2).Text = ""
Else
Adodc1.Recordset.Update
End If
End If
End If
End If
End Sub
Private Sub Form_Load()
Text1(0) = ""
Text1(1) = ""
Text1(2) = ""
Combo1.Text = ""
Combo1.AddItem "True"
Combo1.AddItem "False"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -