Dlookup in query - any pointers?

M

Maurice

Hi guys,

I have a query in which i want to use a dlookup which i have embedded in a
function. Strange thing is that the first record returns the correct value
and after that i get a invalid use of null.. ??

scenario (for testing purposes)

table1:
MyDate (set to date time)
MyAmount (set to currency - standard - two decimals)

table2:
Dummy (text field)
FutureDate (Set to date time)

Created a query with the two fields from table2
both fields added to the querygrid. Third field added as follows: Amount:
getprice(FutureDate)

Module:

function GetPrice(FutureDate) as double
GetPrice=DLookup("MyAmount","table1","MyDate=#" & FutureDate & "#")
end function

As I set. When I run the query the first record returns the correct amount
after that i get a "invalid use of null".

What am i doing wrong?
any pointers appreciated
 
M

Maurice

Never mind guys, forgot the formatting of the date. Issue solved...
must be getting late :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top