Your selection criteria in your DLookups are incomplete. You should probably use something like this (Assuming that the value in [Combo0] is the user name):
If Me.PASSWORD.Value = DLookup("USERNAME", "SYS_USER", "[username]='" & me.[Combo0] & "' and [password]='" & Me.PASSWORD.Value & "'")
That way you restrict the row checked against the combination of selected user and supplied password.
Please note that this method will have to be used everywhere you are using "[password]=" as your selection criterion.
Also, from the MSAccess VBA Help File:
Tips
Although you can use the DLookup function to display a value from a field in a foreign table, it may be more efficient to create a query that contains the fields that you need from both tables and then to base your form or report on that query.
Hope this helps.
BitBlt
Practically a Posting Shark
894 posts since Feb 2011
Reputation Points: 482
Solved Threads: 148
Skill Endorsements: 14
If Me.PASSWORD.Value = DLookup("password", "tblEmployees", "[username]=" & Me.Combo0.Value) Then
Jx_Man
Senior Poster
3,533 posts since Nov 2007
Reputation Points: 1,488
Solved Threads: 524
Skill Endorsements: 64
data type mismatch in criteria expression,, this is the error.
i tried many times yesterday, if any one please can help me here..
thanks in advance..
Are you copied all the code without change it? i was wrong in type table name "tblEmployees", it must be "SYS_USER". Sorry, my bad.
So, it should like this follwoing line:
If Me.PASSWORD.Value = DLookup("password", "SYS_USER", "[username]=" & Me.Combo0.Value) Then
Jx_Man
Senior Poster
3,533 posts since Nov 2007
Reputation Points: 1,488
Solved Threads: 524
Skill Endorsements: 64
Question Answered as of 2 Years Ago by
Jx_Man
and
BitBlt ok the problem is finally solved,
thanks for every one cheered me up.
i only had a small problem in the criteria seection but it is solved now.
thanks alot
It's great to know you already solved it.
But would you like to share with us how you solved it?
So when another user search a same thread like yours they will get the answer too..
Thank you.
Jx_Man
Senior Poster
3,533 posts since Nov 2007
Reputation Points: 1,488
Solved Threads: 524
Skill Endorsements: 64