using dlookup in a query

martinr

Registered User.
Local time
Today, 20:19
Joined
Nov 16, 2011
Messages
74
i have a question re: using dlookup in a query.

i need to include a 'looked up' cost value from a table in a query so this value can be used to calculate other fields (oncosts etc) within the Query.

If I use Dlookup in the query can I reference the matching record Code within the query itself?
Eg; the matching values required are in Table2 and the Query is called ‘queryFreight’, so i'm trying this (but not working);

Dlookup ([ProductFreightCost],[Table2], [Table2].[ProductID]=[queryFreight].[productcode])

is this the correct syntax?
Also, what does the function return if the lookup value isn't found - no matching productID?
 
Look at this link for the proper syntax and use of quotation marks, ie. "
 
Why a Dlookup? Queries are a way to join tables and pull related data from them....So, why not just bring Table2 into the query and link it in the manner it needs to be? Then you can just reference [ProductFreightCost] directly.
 
Why a Dlookup? Queries are a way to join tables and pull related data from them....So, why not just bring Table2 into the query and link it in the manner it needs to be? Then you can just reference [ProductFreightCost] directly.

I totally agree with plog here, and to expand on what he is saying, It has been my experience that not only does a DLookup not return results as fast as a Joined Table Link, but as the amount of Data being processed gets larger, the length of time for the DLookup gets longer as well.

-- Rookie
 

Users who are viewing this thread

Back
Top Bottom