Results 1 to 4 of 4

Thread: Checking for Null

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    3

    Checking for Null

    Even when rst!employee_id is null the code doesn't run through the msgbox and the exit sub statement. Any suggestions are appreciated.

    If rst!EMPLOYEE_ID = Null Then

    MsgBox rst!Name & " is currently assigned to " & rst!POS & ". " & rst!Name & " needs to be removed from this mpcn before this action can continue.", vbCritical + vbOKOnly

    Exit Sub

    End If

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    If IsNull(rst("ID")) then
    '---- blah
    End If

    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi

    If you use a access-mdb then don't forget to set the option "Null-values allowed" to yes for the respictive data-fields.

    In the program you can avoid the problem by connecting the field via:

    txtField = "" & rs.fields("name")


    for example ....


    Franky

  4. #4
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    IsNull function looks better

    ...and if you are in access, have a look at the Nz function...

    Vince

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

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