DLookup

mugman17

Registered User.
Local time
Today, 13:43
Joined
Nov 17, 2000
Messages
110
I have two tables, one table has all the main transactions in it. Now, the system needs to know what currency to use, which I have figured out. Here is my problem, I created the other table to add exchange rates on a daily basis. I want to use a DLookup to find the exchange rate for that given days transactions on a seperate report.

This is my code that does not seem to work:

DLookup("ExchangeRate","tblExchange","TransactionDate=#" & [TransactionDate] & "#")
 
You may have better luck with this syntax:

DLookup("[ExchangeRate]","tblExchange","[TransactionDate]=#" & YourCriteria & "#")

Where YourCriteria is a variable or the contents of a field on your form.

Why are there brackets around your criteria?
If your criteria comes from a field in another table you will have to supply another DLookup as criteria if that value is not available either on your form or stored in a variable.

If your criteria is the source of a bound field on your form, you should use Me.TransactionDate instead:
DLookup("[ExchangeRate]","tblExchange","[TransactionDate]=#" & Me.TransactionDate & "#")

Shep
 

Users who are viewing this thread

Back
Top Bottom