Noticed a problem during testing

JTQ911

Registered User.
Local time
Today, 09:40
Joined
Jul 26, 2007
Messages
83
Noticed a prob in my password checkingform. Example, in my tblUsers, I have Username and Password. Lets say one Username is "John", and his Password is "Blue". Another username is "Bob" amd his password is "Red" In my form, if one enters Username = John and Password = Red, it still works. How do I specifiy within my code that the Username and Password have to be in the same record.

Private Sub SignIn_Click()
Dim User As String
Dim pass As String
User = Nz(DLookup("[username]", "tblUsers", "[username]='" & Me.username & "'"), "")
pass = Nz(DLookup("[password]", "tblUsers", "[password]='" & Me.password & "'"), "")

If User = Forms!WDMLoginAccept!username Then
DoCmd.Close acForm, "WDMLoginAccept", acSaveNo
DoCmd.OpenForm "WDM_1", acNormal
Forms![WDM_1]!WDMaccept = True
Forms![WDM_1]!WDMaccept.Visible = True
Forms![WDM_1]!WDMaccept.Locked = True

Else
MsgBox "Invalid Username/Password combination, please try again"
End If
End Sub

Thanks
 
pass = Nz(DLookup("[password]", "tblUsers", "[username]='" & & Me.username & "'"), "")

If Me.YourPasswordTextBox = pass Then
...validated code here
Else
... invalid entry code here

End If
 
Last edited:
I am getting a compile error? when I copy and paste

pass = Nz(DLookup("[password]", "tblUsers", "[username]='" & & Me.username & "'"), "")

at the marked point. I'm not sure what to do. If you recognize, this code is from someone else you previously helped. I'm just a newbie trying to scrap a working database together and get some experience under my belt. Thanks for the amazingly quick response and help. ! :)
 
I think you only need one of those two & symbols and you will need to keep the one you like the best and remove the other :D
 
Hey Bob,

Please do not take my joke as an offense. :eek: I figure with all of the other posting and watchdogging that you do, you are entitled to a few type-os now and then. I am sure I am guilty of more in my 100+ posts (whoopie) than you are in your 10000+. I think that everyone who visits this forum knows what an incredible asset you have become :cool:
 
Hey, no offense taken. Sorry that it seemed like I didn't think it funny. I am so busy today I forgot to include smileys :) :D ;) :cool: :)

There - a few extra for good measure. :)
 
Thank you

:):):)

Cant thank the wonderful people of this forum enough. Where do I send a check lol?
 
A check is never required, but a good word (in the form of a positive reputation comment or a positive rating for a thread) is always appreciated.

Another thing is to remember to try to return the favor by taking the opportunity to reply when you have information to share with the forum .
 

Users who are viewing this thread

Back
Top Bottom