![]() |
Invalid Use of Null
I've been retrieving values using ADO, and setting those
values to a variable MTDSALES (for month to date sales) which is declared as double. The problem is that when the retrieved value is Null I get an error "Invalid Use of Null". Any ideas on how to handle this situation efficiently? I could send all retrieved values to a function which checks for the NUll case and then sends back 0.00 if it is Null but I'm not sure if this the best way to go about it. Thanks in advance. |
Invalid Use of Null
if isnull(something) then
MTDSALES = 0.0 else MTDSALES = Something End if -- Regards, Tom Ogilvy "AL" wrote in message ... I've been retrieving values using ADO, and setting those values to a variable MTDSALES (for month to date sales) which is declared as double. The problem is that when the retrieved value is Null I get an error "Invalid Use of Null". Any ideas on how to handle this situation efficiently? I could send all retrieved values to a function which checks for the NUll case and then sends back 0.00 if it is Null but I'm not sure if this the best way to go about it. Thanks in advance. |
Invalid Use of Null
Thanks Tom!!
-----Original Message----- if isnull(something) then MTDSALES = 0.0 else MTDSALES = Something End if -- Regards, Tom Ogilvy "AL" wrote in message ... I've been retrieving values using ADO, and setting those values to a variable MTDSALES (for month to date sales) which is declared as double. The problem is that when the retrieved value is Null I get an error "Invalid Use of Null". Any ideas on how to handle this situation efficiently? I could send all retrieved values to a function which checks for the NUll case and then sends back 0.00 if it is Null but I'm not sure if this the best way to go about it. Thanks in advance. . |
Invalid Use of Null
"AL" wrote ...
I've been retrieving values using ADO, and setting those values to a variable MTDSALES (for month to date sales) which is declared as double. The problem is that when the retrieved value is Null I get an error "Invalid Use of Null". Any ideas on how to handle this situation efficiently? Review whether is it possible to change the database column's definition to NOT NULL and provide a DEFAULT value e.g. zero. If this does not fit your business rules i.e. a NULL ('not known') value has distinct meaning from zero, then rewrite the query using a CASE (or equivalent syntax) to provide a value in place of a NULL. Jamie. -- |
All times are GMT +1. The time now is 12:09 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com