my program has two user accounts - administrator and a guest
when i login as an administrator then i have the full access on the commands while if i login as a guest then only the basic commands will be availabe. here's my code:
Private Sub cmdLogin_Click()
Dim Username As String
Dim Password As String
Username = Me.txtUser.Text
Password = Me.txtPwd.Text
If Username = adoLog.Recordset("User").Value And Password = adoLog.Recordset("Password") And adoLog.Recordset("UType") = "Administrator" Then
Unload Me
frmMain.Show
ElseIf adoLog.Recordset("UType") = Guest Then
With frmMain
.Show
.cmdEdit.Enabled = False
.cmdDelete.Enabled = False
.cmdAccounts.Enabled = False
End With
ElseIf txtUser.Text = "" And txtPwd.Text = "" Then
MsgBox "Please enter your username and password!", vbOKOnly + vbCritical, "Login"
txtUser.SetFocus
Else
MsgBox "Wrong credentials!", vbOKOnly + vbCritical, "Login"
txtUser.Text = ""
txtPwd.Text = ""
txtUser.SetFocus
End If
End Sub
my problem is that when i use the guest account, the messagebox "Wrong credentials" appear and therefor can not login, but if i use the administrator account i can access the system..can anyone help me?


Reply With Quote

Bookmarks