Results 1 to 3 of 3
  1. #1
    Join Date
    May 2021
    Posts
    5

    Exclamation Problem with dates in multi criteria search form if a record doesn't contain a date

    Hi Guys,



    Having issues with a date search in a multi criteria search form. My database field is called DateComplete
    I want the query to return records that fall between a certain criteria IF the user has specified a date range, but
    ignore the date if no range has been specified. The problem is that DateComplete is not always set


    This works if there are dates specified- if DateComplete >=[Forms]![NewSearchForm]![CompleteFrom] And <=[Forms]![NewSearchForm]![CompleteTo]
    i've tried adding OR ISNULL - but this brings back all records, and ignores any other criteria set on the form!


    I hit a problem where access would throw an error if no dates were input so I had to set the CompleteFrom to the date the database was
    created and the CompleteTo to todays date - unsure if this is compounding the issue?

    Many thanks

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    You nearly have the solution. You need to specify the criteria you are checking in the is null expression.

    >= [Forms]![NewSearchForm]![CompleteFrom] OR [Forms]![NewSearchForm]![CompleteFrom] Is Null
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    Join Date
    May 2021
    Posts
    5
    That worked! Thank you so much

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

Similar Threads

  1. Replies: 3
    Last Post: 03-09-2017, 08:48 AM
  2. Multi Search Criteria Form/Query
    By NickWren in forum Access
    Replies: 4
    Last Post: 10-04-2016, 05:42 PM
  3. Multi table Date query to a Between dates frm
    By Bomberboy67 in forum Queries
    Replies: 1
    Last Post: 12-16-2015, 07:44 PM
  4. Replies: 1
    Last Post: 10-29-2014, 10:23 AM
  5. Replies: 18
    Last Post: 01-31-2013, 01:18 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