Dlookup with criteria as column in query (1 Viewer)

reggiete

Registered User.
Local time
Today, 12:06
Joined
Nov 28, 2015
Messages
56
Hello All,

I am trying to build an query with a dlookup with the criteria being a column within the query.

for example,

I have a query that has following columns: Testing Month, Question, QuestionID, Total Fails: Dlookup(Column)

example of current query dlookup: Total Fails: DLookUp("AT01","Copy Of Qryrpt_MysteryShopper_AnalystDashboard","[Testing Month] = 'June 2016'")

So i would like the dlookup criteria to lookup the "Testing Month" instead of me actually placing the testing month in the criteria. The testing month is the column i want to lookup which is within the same query with the dlookup.

Any help would be appreciated.
 

plog

Banishment Pending
Local time
Today, 14:06
Joined
May 11, 2011
Messages
11,658
I am trying to build an query with a dlookup with the criteria being a column within the query

DLookups have no place in a query. You simply JOIN that external datasource apporpriately. So, you should add [Copy Of Qryrpt_MysteryShopper_AnalystDashboard] to your query, JOIN it to the [Testing Month] field and bring in the [AT01] field instead of Dlooking it up.

Also, your naming conventions leave a lot to be desired. Why are you using a copy of a query? You should also remove spaces from table/field names. Just makes coding easier. [AT01] is a poor field name. I have no idea what data that field is to contain. Sure this database isn't for me, but who knows if I may come after you and have to work on this thing.
 

GinaWhipp

AWF VIP
Local time
Today, 15:06
Joined
Jun 21, 2011
Messages
5,899
Why? What is the issue with using the Criteria?
 

Users who are viewing this thread

Top Bottom