没有其他的了我吧所有的代码发上来
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "请您输入查询条件", 32, "系统"
Exit Sub
Else
= adCmdText
Adodc1.RecordSource = "select * from [user] where
用户名 = '" & Trim(Text1.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Text2.Text = Adodc1.Recordset.Fields("用户名")
Text3.Text = Adodc1.Recordset.Fields("密码")
Combo1.Text = Adodc1.Recordset.Fields("权限")
Text1.Text = ""
Text2.Enabled = False
Text3.Enabled = False
Combo1.Enabled = False
Command3.Enabled = True
Else
MsgBox "没有您要查找的员工,请您确认后重新输入", 32, "系统"
End If
End If
End Sub
Private Sub Command2_Click()
Command3.Enabled = False
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text4.Enabled = True
Combo1.Enabled = True
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text2.BackColor = &H80000005
Text3.BackColor = &H80000005
Text4.BackColor = &H80000005
Combo1.BackColor = &H80000005
Combo1.Text = "业务员"
End Sub
Private Sub Command3_Click()
Text2.Enabled = True
Text3.Enabled = True
Combo1.Enabled = True
Text2.BackColor = &H80000005
Text3.BackColor = &H80000005
Combo1.BackColor = &H80000005
End Sub
Private Sub Command4_Click()
If Text2.Text = "" Then
MsgBox "姓名不能为空!", 32, "系统"
Exit Sub
Else
End If
If Text3.Text = "" Then
MsgBox "密码不能为空!", 32, "系统"
Exit Sub
Else
End If
If Text4.Text = "" Then
MsgBox "请再次输入密码!", 32, "系统"
Text4.SetFocus
Exit Sub
Else
End If
If Text4.Text <> Text3.Text Then
MsgBox "两次密码输入不一致,请重新输入!", 32, "系统"
Text4.Text = ""
Text4.SetFocus
Exit Sub
Else
End If
If Combo1.Text = "业务员" Then
GoTo zx
Else
End If
If Combo1.Text = "管理员" Then
GoTo zx
Else
MsgBox "权限只能为“业务员”或“管理员”!", 32, "系统"
Exit Sub
End If
zx:
= adCmdText
Adodc1.RecordSource = "select * from [user] where
用户名 = '" & Trim(Text2.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
myval = MsgBox("已有此人员记录!按确认键修改记录,否则请重新输入!", vbYesNo, "系统")
If myval = vbYes Then
Adodc1.Recordset.Fields("用户名") = Trim(Text2.Text)
Adodc1.Recordset.Fields("密码") = Trim(Text3.Text)
Adodc1.Recordset.Fields("权限") = Trim(Combo1.Text)
Adodc1.Recordset.Update
MsgBox "数据修改成功!", , "系统提示"
Adodc1.Refresh
Exit Sub
End If
Else
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("用户名") = Trim(Text2.Text)
Adodc1.Recordset.Fields("密码") = Trim(Text3.Text)
Adodc1.Recordset.Fields("权限") = Trim(Combo1.Text)
Adodc1.Recordset.Update
Adodc1.Recordset.Close
MsgBox "数据保存成功!", , "系统提示"
Adodc1.Refresh
End If
Call Form_Load
End Sub
Private Sub Command5_Click()
Form3.Show
Unload Me
End Sub
Private Sub Command6_Click()
Call Form_Load
End Sub
Private Sub Command7_Click()
If Text2.Text = "" Then
MsgBox "请查找是否有此记录!", , "系统提示"
Exit Sub
End If
If Text2.Text <> "" Then
= adCmdText
Adodc1.RecordSource = "select * from [user] where
用户名 = '" & Trim(Text2.Text) & "'and 权限 = '" & Trim(Combo1.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
myval = MsgBox("确定删除此用户吗?", vbYesNo, "系统")
If myval = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Refresh
End If
MsgBox "删除成功!", , "系统提示"
Call Form_Load
End If
Else
MsgBox "请查找是否有此记录!", , "系统提示"
End If
End Sub
Private Sub Form_Load()
Command3.Enabled = False
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text2.Enabled = False
Text2.BackColor = &HFFFFC0
Text3.Enabled = False
Text3.BackColor = &HFFFFC0
Text4.Enabled = False
Combo1.Enabled = False
Combo1.BackColor = &HFFFFC0
Text4.BackColor = &H0&
Combo1.Text = ""
Combo1.AddItem "业务员"
Combo1.AddItem "管理员"
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
aword = aword + 1
If KeyAscii = 8 Then Exit Sub
Select Case Chr(KeyAscii)
Case "a" To "z", "A" To "Z", "0" To "9"
Text3.SelStart = aword
Case Else
MsgBox ("密码只能为英文字母或者阿拉伯数字")
Text3.Text = ""
Text3.SetFocus
End Select
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
aword = aword + 1
If KeyAscii = 8 Then Exit Sub
Select Case Chr(KeyAscii)
Case "a" To "z", "A" To "Z", "0" To "9"
Text4.SelStart = aword
Case Else
MsgBox ("密码只能为英文字母或者阿拉伯数字")
Text4.Text = ""
Text4.SetFocus
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
End Select
End Sub