-
Hi. I'm stepping through a record set from a database, such as in the following code:
Code:
oRS.MoveFirst
Do while NOT oRS.eof
Dim fx as string
fx = oRS("FaxNumber")
oRS.MoveNext
Loop
oRS.Close
But in my database some of the faxnumber fields are empty. This is causing the following error:
"Runtime error 94: Invalid use of null"
I tried putting an if statement like
Code:
if oRS("FaxNumber") is NOT NULL then..
but that didn't work, for the same reasons...
I don't know enough about VB to know how to handle this... seems this worked fine when I did it in ASP...
tx
d8
-
You need the IsNull function for this (I know, Nulls are a pain in the a**!!!). Try this:
if Not IsNull(oRS("FaxNumber")) Then..
Good luck.
-
There are a couple of things you can do:
fx = oRS("FaxNumber") & ""
-or-
If not IsNull(oRS("FaxNumber")) Then
fx = oRS("FaxNumber")
End If
BTW take the Dim out of the loop.
-
thank you
thanks for help!
problem has been solved.
and advice with Dim duly noted :)