the login form has 2 Textbox and 1 Combobox (usernameTB, passwordTB, userTypeCB) im finish with the part of comparing the username and the password whether the two match in my table, but what i cant seem to do is compare whether the user type(Administrator, Standard User) match the datas in the table.
HERE is my code so far and whenever I try to login using this codes it keeps on telling me "Run-time error '2471': The expression you entered as a query parameter produced this error: 'Administrator' (TAKE NOTE that the value's in the userTypeCB are "Administrator" and "Standard User"
one last thing, this isnt the complete code because this is a copy my project that im working on, i made a diff. copy so that i could do whatever i want without the harm of totally ruining the whole project. Any help would be appreciated. Thanks!
Expand|Select|Wrap|Line Numbers
- Private Sub signinBTN_Click()
- Dim adminType As String
- Dim userType As String
- If IsNull(Me.usernameTB) Then
- MsgBox "Please enter a username", vbInformation, "Need Username!"
- Me.usernameTB.SetFocus
- Exit Sub
- End If
- If IsNull(Me.passwordTB) Then
- MsgBox "Please enter a password!", vbInformation, "Need Password!"
- Me.passwordTB.SetFocus
- Exit Sub
- End If
- If Nz(DLookup("Password", "UserINFO", "Username = '" & Me.usernameTB & "'"), "GarbageEntry") = Me.passwordTB Then
- MsgBox "User Found!", vbOKOnly
- If Me.passwordTB.Value = DLookup("Password", "userINFO", "ID =" & Me.userTypeCB.Value) Then
- ID = Me.userTypeCB.Value
- MsgBox "password and user type match!"
- Else
- MsgBox "they dont match!"
- End If
- Else
- MsgBox "Incorrect Username or Password"
- Me.usernameTB = ""
- Me.passwordTB = ""
- Me.usernameTB.SetFocus
- End If
- End Sub