Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2010
    Location
    Perth
    Posts
    6

    Question Problem checking for Null Value of a Textbox.

    HI,



    I am having trouble testing for the Null Value of a Textbox. In the following code when each one of the Textbox's is Null I want to do the Then code.

    If Form_Contacts.Call_Listing_Subform.Form![txtFUDate].Value = Null And Form_Contacts.Call_Listing_Subform.Form![txtSubject].Value = Null And Form_Contacts.Call_Listing_Subform.Form![txtFinalised].Value = Null Then

    Code goes here.

    End If

    When I break the code, when the Textbox's Value = Null the Then Code is not executed. What am I doing wrong?

    Thanks,

    Dean.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Nothing is ever = to Null. You can use the IsNull() function to test, or this tests for both Null and a zero length string:

    If Len(Whatever & vbNullString) = 0 Then

    replacing Whatever with the appropriate form reference, variable, etc.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Quote Originally Posted by pbaldy View Post
    If Len(Whatever & vbNullString) = 0 Then
    Not that I'm stalking you or anything. . .

    But this.

    Is.

    AWESOME!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    LOL! Wish I could take credit, but I got it from somebody else.

    Stalkers should be warned that my wife carries pepper spray and isn't afraid to use it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-29-2010, 10:23 AM
  2. Null Date control code problem
    By DanW in forum Forms
    Replies: 2
    Last Post: 11-10-2009, 03:13 PM
  3. Is null problem
    By rockape in forum Programming
    Replies: 5
    Last Post: 09-29-2009, 12:46 PM
  4. Replies: 2
    Last Post: 09-26-2009, 07:19 AM
  5. Replies: 1
    Last Post: 03-25-2009, 02:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums