0

help how can i know if the user is not an admin

i have combo box in my combo box have a user or admin additem if he choose admin then all i want is to validate if the username and password is for admin user this is my code

Private Sub Form_Load()
Call Opencn
With Combo1
        .AddItem ("Administrator")
        .AddItem ("User")
End With
End Sub

Private Sub lvButtons_H1_Click()
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM Login WHERE UserName = '" & Text1.Text & "' AND Password = '" & Text2.Text & "'", cn, adOpenKeyset, adLockPessimistic
If Combo1.Text = "Administrator" Then
If rs.RecordCount > 0 Then
frmBegin.Label4.Caption = rs!Fullname
frmBegin.Show
Unload Me
Exit Sub
Else
MsgBox "Your Username or Password is incorrect", vbCritical
End If
End If
End Sub
2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by debasisdas
0

help how can i know if the user is not an admin

i have combo box in my combo box have a user or admin additem if he choose admin then all i want is to validate if the username and password is for admin user this is my code

please post clearly using correct english and grammer.

-1

help how can i know if the user is not an admin

i have combo box, in my combo box have a user or admin additem, if he choose admin then all i want is to validate if the username and password is for admin user, this is my code:

Private Sub Form_Load()
Call Opencn
With Combo1
        .AddItem ("Administrator")
        .AddItem ("User")
End With
End Sub

Private Sub lvButtons_H1_Click()
Set rs = New ADODB.Recordset
rs.Open "SELECT * FROM Login WHERE UserName = '" & Text1.Text & "' AND Password = '" & Text2.Text & "'", cn, adOpenKeyset, adLockPessimistic
If Combo1.Text = "Administrator" Then
If rs.RecordCount > 0 Then
frmBegin.Label4.Caption = rs!Fullname
frmBegin.Show
Unload Me
Exit Sub
Else
MsgBox "Your Username or Password is incorrect", vbCritical
End If
End If
End Sub
Votes + Comments
That doesn't answer his question at all.
0

how you decide if the user is an admin user or not ?

what is the logic for that ?

is there is corresponding field for that value as well ?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.