This line of code?

marknufc

Registered User.
Local time
Today, 04:30
Joined
Dec 12, 2012
Messages
25
My DB doesn't like this line of code, why?

If Me.txtpassword = Nz(DLookup("LecturerPassword", "user_tbl", "[LecturerLoginID] = " & Chr(34) & Me.txtuser & Chr(34)), "")

it has a problem with the [LecturerLoginID], I'm not a coder so I apologise if this is a simple problem.
 
Is [LecturerLoginID] a numeric field.

What is the data type of Me.txtuser
 
[LecturerLoginID] is txt

Me.txtuser is the text field on a log in form to enter a username
 
Try:
Me.txtpassword = Nz(DLookup("LecturerPassword", "user_tbl", "[LecturerLoginID] = '" & Me.txtuser & "'"), "")
 
I now get a compile error,

Me.txtpassword = Nz(DLookup("LecturerPassword", "user_tbl", "[LecturerLoginID] = '" & Me.txtuser & "'"), "") then
With Forms!frmStoredLogins
.txtLecturerLoginID = Me.txtuser
.txtDateTimeLogin = Now

End With

it doesnt like the "Then"
 
You've dropped the open If from the first code line.

Are you sure of typos?

Try pasting
? Nz(DLookup("LecturerPassword", "user_tbl", "[LecturerLoginID] = " & Chr(34) & "xxx" & Chr(34)), "")
into the Immediate window, where xxx is the name of one of your users.
 
Done that, its gone back to not liking [LecturerLoginID]
 
Try:
If Me.txtpassword = Nz(DLookup("LecturerPassword", "user_tbl", "[LecturerLoginID] = '" & Me.txtuser & "'"), "") = "" Then
 
are you sure it's LecturerLoginID with no spaces?

100% sure, that was my first check. I've found DB that has a working user audit log. I've taken the code from it and I'm trying to modify it to fit my DB.

I keep getting error after error, I'm close to giving up on it. I'm a forensic student so coding isn't really my thing, Databases is a unit we have to do though :(
 
the other alternative is that [lecturerloginid] is numeric, which is what BobFitz asked earlier.

where do you get that from?
 
Going back to the original post, what does "My DB doesn't like this line of code" mean exactly? How does the problem manifest itself? Compile error, run time error, what?

Post your database.
 

Users who are viewing this thread

Back
Top Bottom