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

Recommended Answers

All 3 Replies

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.

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
commented: That doesn't answer his question at all. -2

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 ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.