Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"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. -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Failed to save table attributes of (null) into (null). | Excel Discussion (Misc queries) | |||
product key invalid? | Excel Discussion (Misc queries) | |||
COUNTIF says Null = Blank but Blank < Null | Excel Worksheet Functions | |||
cell value based on null/not null in another cell | Excel Worksheet Functions | |||
Invalid use of Null | Excel Programming |