Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
AL AL is offline
external usenet poster
 
Posts: 37
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
AL AL is offline
external usenet poster
 
Posts: 37
Default 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.




.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default 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.

--
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed to save table attributes of (null) into (null). Luca Brasi Excel Discussion (Misc queries) 2 February 4th 09 04:30 PM
product key invalid? Emiljan Excel Discussion (Misc queries) 2 January 21st 08 05:55 PM
COUNTIF says Null = Blank but Blank < Null Epinn Excel Worksheet Functions 4 October 25th 06 08:03 PM
cell value based on null/not null in another cell spence Excel Worksheet Functions 1 February 18th 06 11:49 PM
Invalid use of Null Stuart[_5_] Excel Programming 2 February 21st 04 08:22 AM


All times are GMT +1. The time now is 02:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"