Results 1 to 4 of 4

Thread: Invalid use of Null!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ilirska Bistrica, Slovenia
    Posts
    242

    Exclamation

    Hello!

    I'm developing a database related program and when a field that I wanna retrieve from DB is empty, it returns error 94 (Invalid use of null).
    How can I avoid this error and retrieve data from database? Is it enough to write this statement before loading data from database:
    Code:
    On Error Resume Next
    Zvonko
    Zvonko Bostjancic
    Ilirska Bistrica, Slovenia
    [email protected]
    Using VS6 Professional with SP3
    Programming mostly in VB and I've started to learn VC++ & MFC

  2. #2
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    If for example you were retrieving a field called Employee into a text box called txtEmployee then ...

    Code:
    txtEmployee.Text = "" & rs!Employee
    The "" would stop any error due to Employee being empty.
    VB6 sp5, SQL Server 2000, C#

    There are no stupid questions. Only stupid people.

  3. #3
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    or you can

    try

    Code:
    if NOT (rs!Employee) then txtEmployee.text = rs!Employee

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    sowwy about last one

    Code:
    if NOT ISNULL(rs!Employee) then txtEmployee.text = rs!Employee

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