MS Query DLookup not returning desired results when looking up text

Nico

New member
Local time
Today, 02:31
Joined
May 12, 2016
Messages
6
Hi

I am trying to lookup the Company Name in a query called Qry_MonthlyGPForecastCombined, from a query called Qry_WIPReport, where the Line ID in Qry_MonthlyGPForecastCombined = Line ID in Qry_WIPReport. If the line IDs match, it means that the Company is showing on the forecast report.

I have created a column with the following details:

ShowingOnForecast: DLookUp("Company Name","Qry_MonthlyGPForecastCombined","Line ID=" & [Line ID]).

However, when I run the query I receive #error in each row. Can someone tell me what I am doing wrong.

Kind Regards
Nick
 
Just join the two fields in the query - don't do a lookup.
 
typical example of how time is wasted when having spaces in field names.

try

DLookUp("[Company Name]",".....
 
Hi CJ

ShowingOnForecast: DLookUp("[Company Name]","Qry_MonthlyGPForecastCombined","Line ID=" & [Line ID]) didn't work.

Kind Regards
Nick
 
'Didn't work' doesn't help me help you. However, just seen Minty's response - I would go that way instead.
 
Sorry CJ. It returned #error in each row.
 
another space issue

","Line ID=" & [Line ID])

I presume you know that if no match is found dlookup returns null? You would be better to follow Minty's suggestion or use dcount
 
Hi CJ / Minty

CJ - Unfortunately, that came up with the same error.

Minty - thanks for you suggestion, this worked.

I am still learning so your advice and suggestions are most appreciated.

Thank you

Kind Regards
Nick
 

Users who are viewing this thread

Back
Top Bottom