Results 1 to 4 of 4

Thread: String can't be null?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    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

  2. #2
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    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.
    "It's cold gin time again ..."

    Check out my website here.

  3. #3

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142

    thank you

    thanks for help!
    problem has been solved.

    and advice with Dim duly noted


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width