From: Maurice on
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

--
Maurice Ausum
From: Maurice on
Never mind guys, forgot the formatting of the date. Issue solved...
must be getting late :-)

--
Maurice Ausum


"Maurice" wrote:

> 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
>
> --
> Maurice Ausum