Results 1 to 5 of 5
  1. #1
    dubsdj is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    4

    Date Field empty if statement

    Hi, Im trying to check if a date has been entered in a field in an Access form.

    I tried this:



    If IsNull("Return Date") Then
    MsgBox "Field is empty"
    Else
    MsgBox "Field is not empty"
    End If

    but it says the field is not empty when it actually is empty.

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You're not testing the field, you're testing the literal text string "Return Date", which will never be Null. Try

    If IsNull(Me.[Return Date]) Then
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    dubsdj is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2011
    Posts
    4
    If IsNull(BegDate) Or IsNull(EndDate) Then


    seems to work for me

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I take it you want to thank Paul for his suggestion and then use the Thread Tools and mark this thread as Solved, yes?

  5. #5
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You can typically get away with that, but I prefer being more specific. Is BegDate a field, control or variable? You can't tell from that.
    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. Delete Field if Empty?
    By bpowers2010 in forum Reports
    Replies: 1
    Last Post: 07-10-2010, 12:04 AM
  2. set date field on form to date variable
    By laavista in forum Access
    Replies: 3
    Last Post: 06-28-2010, 03:03 AM
  3. empty field
    By amber mara in forum Access
    Replies: 2
    Last Post: 05-05-2010, 01:46 PM
  4. replace a empty field with the word "none" how??
    By techexpressinc in forum Queries
    Replies: 1
    Last Post: 01-15-2010, 11:02 AM
  5. IIF statement to populate field
    By GriffyNJ in forum Queries
    Replies: 0
    Last Post: 10-13-2009, 10:07 AM

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