Query Criteria Dlookup (1 Viewer)

jmaty23

Registered User.
Local time
Yesterday, 19:16
Joined
Jul 24, 2012
Messages
53
I am trying to run a query and filter it by the current authorized user id in my database.

Code:
=DLookUp("property","tblwoOption","[userid] = #" & auth.userid & "#")

auth.userid is in a class module that should show the current user id number and for some reason it isn't working. When I try to run the query, the Enter Parameter Value box shows with auth.userid. Is it possible to call these in query criteria's?
 

pr2-eugin

Super Moderator
Local time
Today, 00:16
Joined
Nov 30, 2011
Messages
8,494
jmaty23, you have enclosed the criteria with ## which is normally used for Dates.. so try this..
Code:
=DLookUp("property","tblwoOption","[userid] = " & auth.userid)
 

jmaty23

Registered User.
Local time
Yesterday, 19:16
Joined
Jul 24, 2012
Messages
53
I copied what you said it should be and the query changed it to this:

Code:
=DLookUp("property","tblwoOption","[userid] = " & [auth].[userid])

When I try to run the query, I still get the Enter Paramater Value box.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:16
Joined
Feb 19, 2002
Messages
43,352
What is [auth]? If you are trying to reference a control on the active form, use Me.UserID.
 

Users who are viewing this thread

Top Bottom