Private Sub Command1_Click()If Trim(Text1(0)。Text) = "" Then MsgBox "用户名不能为空!", vbExclamation + vbOKOnly, "警告" Text1(0)。SetFocus Exit SubEnd IfIf Trim(Text1(1)。
Text) = "" Then MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告" Text1(1)。SetFocus Exit SubEnd IfIf Trim(Text1(2)。Text) = "" Then MsgBox "确认密码不能为空!", vbExclamation + vbOKOnly, "警告" Text1(2)。
SetFocus Exit SubEnd IfIf Trim(Text1(1)。Text) <> Trim(Text1(2)。Text) Then MsgBox "确认密码不正确!", vbExclamation + vbOKOnly, "警告" Text1(2)。
SetFocus Exit SubEnd IfDim aa As Integeraa = 0If Option1(2)。Value = True Then For i = 0 To 3 If Check1(i)。Value = 1 Then aa = 1 Exit For End IfNext iIf aa = 0 Then MsgBox " 普通用户至少要有一项权限!", vbExclamation + vbOKOnly, "警告"Exit SubEnd IfEnd IfDim mrc As ADODB。
Recordsettxtsql = "select * from use where username='" & Trim(Text1(0)。Text) & "'"Set mrc = ExecuteSQL(txtsql)If mrc。EOF = False Then MsgBox " 已存在该用户!", vbExclamation + vbOKOnly, "警告" Text1(0)。
SetFocus Text1(0)。SelStart = 0 Text1(0)。SelLength = Len(Text1(0)。Text) Exit SubEnd Iftxtsql = "select * from use"Set mrc = ExecuteSQL(txtsql)mrc。
AddNew mrc。Fields(0) = Trim(Text1(0)。Text) mrc。Fields(1) = Trim(Text1(1)。Text)For i = 0 To 2 If Option1(i)。Value = True Then Select Case i Case 0 mrc。
Fields("admin") = "y" Case 1 mrc。Fields("readonly") = "y" Case 2 For j = 0 To 3 If Check1(j)。Value = 1 Then Select Case j Case 0 mrc。
Fields("qx1") = "y" Case 1 mrc。Fields("qx2") = "y" Case 2 mrc。Fields("qx3") = "y" Case 3 mrc。
Fields("qx4") = "y" End Select End If Next j End Select End If Next i mrc。Update MsgBox " 用户添加成功!", vbExclamation + vbOKOnly, "警告" Text1(0)。
Text = "" Text1(1)。Text = "" Text1(2)。Text = ""End SubPrivate Sub Command2_Click()Unload MeEnd SubPrivate Sub Form_Load()Option1(2)。
Value = TrueEnd SubPrivate Sub Form_Resize()Text1(0)。SetFocusEnd SubPrivate Sub Option1_Click(Index As Integer)If Index <> 2 ThenFor i = 0 To 3 Check1(i)。
Enabled = FalseNext iElseFor i = 0 To 3 Check1(i)。Enabled = TrueNext iEnd IfEnd Sub。