Hi,
I'm still newbie with ACCESS n VBA code.
I have a form and a table login(user, password, role)where user can login with username and password by referring to Login table.
Private Sub LOGIN_Click()
Dim LOGIN As String
Dim rs As Object
If Me.txtuser.value <> "" And Me.txtpassword.value <> "" Then
GENERATE = "select * from login where Username ='" & Me.txtuser.value & "' and Password ='" & txtpassword.value & "'"
Me.RecordSource = GENERATE
Set rs = Me.RecordsetClone
If Not rs.EOF Then
MsgBox "YOU ARE LOGIN AS' " & MeLogin.rule & "'"
Else
MsgBox "Your Username and Password doesnt Match!!"
End If
Else
MsgBox "Please Input your username and password to Login"
End If
End Sub
How can i view the role in MsgBox according to username and password in table login? Im having trouble in here (Underline words). The Logic is if username and password has been filled and then search in table. If Its TRUE then it will show MsgBox with the role user in table Login.
Or do you have any better codes for this?
Thanks for help..
Best Regards,
Rivai