Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ISNULL works and then it don't 1

Status
Not open for further replies.

PeterOcean

Programmer
Mar 26, 2002
27
0
0
CA
I have a head scratcher of a problem. I am creating an XML doc with the results of a db query. An element is created with the name of the field and the text value of the element is set to the value of the field. The problem happens when I check to see whether the value is null.

My code is as follows:
if ISNULL(rs.fields.item(iCnt).value) then
xml.Text = ""
else
xml.text = rs.fields.item(iCnt).value
end if

This works fine in debug mode, but when I just let it run I get an error "Invalid use of NULL" and it stops in the else statement.
 
You can probably do without the IsNull and just use:

xml.text = rs.fields.item(iCnt).value & ""

I'm not exactly sure what the problem is with IsNull but there are several KB articles about various limitations when used with an ADO 2.x recordset.

Paul Bent
Northwind IT Systems
 
Thanks for the reply Paul. All of a sudden it all seems to work and I haven't made a single change, I 'll have to watch that a bit closer and I will certainly try out your suggestion

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top