Solved

Microsoft VBScript runtime (0x800A005E) Invalid use of Null: 'cdbl'

Posted on 2010-09-09
4
1,141 Views
Last Modified: 2012-06-21
Hi,

I receive the below error message on line 2 of the attached vb script code snippet:

Microsoft VBScript runtime (0x800A005E) Invalid use of Null: 'cdbl'

Do any experts know how I can fix this error? It only seems to flag now and again?

Thanks.
col_num = col_num + 1
col_sum(col_num) = col_sum(col_num) + sign * cdbl(itm.Value)
										if (sign * cdbl(itm.Value)) > 0 then
											fontcolor_st = ""
											fontcolor_et = ""
										else
											fontcolor_st = "<font color=red>"
											fontcolor_et = "</font>"
										end if
										Response.Write "<td class=s1d1_ce_r valign=top >" & fontcolor_st & GetYourFormat(sign * cdbl(itm.Value),number_format) & fontcolor_et & "</td>"

Open in new window

0
Comment
Question by:aspnet-scotland
  • 2
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
VBClassicGuy earned 250 total points
ID: 33637687
Maybe itm.Value sometimes is NULL? Might want to check for a valid value before executing the statement. Like:
If itm.Value <> Null Then
   col_sum(col_num) = col_sum(col_num) + sign * cdbl(itm.Value)
End If
0
 

Author Comment

by:aspnet-scotland
ID: 33637767
I also get the error on the first line of the attached if you could help...
if (sign * cdbl(itm.Value)) > 0 then
											fontcolor_st = ""
											fontcolor_et = ""
										else
											fontcolor_st = "<font color=red>"
											fontcolor_et = "</font>"
										end if

Open in new window

0
 

Author Comment

by:aspnet-scotland
ID: 33638005
I tried the attached but I still get the error?
if (sign * cdbl(itm.Value)) > 0 OR isNull(sign * cdbl(itm.Value)) then
											fontcolor_st = ""
											fontcolor_et = ""
										else
											fontcolor_st = "<font color=red>"
											fontcolor_et = "</font>"
										end if

Open in new window

0
 
LVL 14

Expert Comment

by:VBClassicGuy
ID: 33638147
I think you have to do a check for "not null" on itm.Value all bu itself first, before you evaluate or do anything else. Just like my first example, make sure itm.Value is not null, then procede with your code.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question