Results 1 to 6 of 6
  1. #1
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215

    Date query question.

    Assume I have a Date field. The date values may either be filled in or they may be null.

    So, you would do the Between Nz([begindate],#..#) And Nz([enddate],#..#) OR IS NULL. That’s simple enough.

    However,

    I only want the Nulls to not show up if the user inputs any criteria in the the [begindate] AND [enddate]. If the user inputs just a [begindate] or just an [enddate] or nothing at all – then displaying the Nulls is fine.

    Does anyone know a way to do this?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Not sure I understand "want the Null values shown if they choose not to enter any criteria and the Null values shown if they choose to enter some search criteria". Doesn't that say you ALWAYS want the records with null?

    I don't use dynamic parameterized queries. I use VBA to construct filter criteria.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215
    Basically, if they enter in search criteria for the [begindate] AND [enddate], I don't want any Nulls to show up. However, if they enter in criteria for the [begindate] OR [enddate], then I want the Nulls to be displayed. Also, in the case of not entering any criteria at all, displaying all information (including nulls) is fine.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    I would go with VBA and pass constructed filter criteria to form or report.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    McArthurGDM is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    215
    Would you know how to do that? Haha

    Hit me with the barebones of the VBA code if you could.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Date Query problem/question
    By normie in forum Queries
    Replies: 1
    Last Post: 03-06-2013, 02:05 PM
  2. Replies: 3
    Last Post: 08-21-2012, 03:05 PM
  3. Date Question
    By joewhitt in forum Access
    Replies: 7
    Last Post: 07-10-2011, 12:52 PM
  4. Of course...a Date Question
    By ffowler in forum Queries
    Replies: 3
    Last Post: 06-08-2011, 03:44 PM
  5. Query (Date Question)
    By cillajones in forum Queries
    Replies: 1
    Last Post: 08-09-2008, 12:05 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