Prev: Query for previous week, Sun thru Sat, from date field
Next: CAN I RUN SEVERAL QUERYS FROM ONE CONTROL BUTTUON
From: Maurice on 9 Apr 2010 14:17 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 9 Apr 2010 14:41
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 |