Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2009

    Unanswered: Query Criteria Question

    I have a query set up that displays various information and one of the fields is a date.

    How do I go about setting up the criteria for the date field so the user can pull the query after selecting that they wanted it before or after a date they input in a text box or in between two dates they enter in two text boxes?

    Thanks for help,

  2. #2
    Join Date
    Jun 2009
    I found the following information:

    Before a date: < #2/2/2006#
    After a date: > #2/2/2006#
    Between two dates: >#2/2/2006# and <#2/4/2006#

    Is the only way I can go about doing this is to set up 3 queries that are triggered depending on which "filter" the user wants to use?

    By filter I mean, before, after, or between dates.

    Correct me if I am wrong, but I can exchange the date for a textbox value in the criteria, correct? I am unsure b/c it is a date... newb question I know.


  3. #3
    Join Date
    Nov 2007
    Adelaide, South Australia
    Between two dates can also be: Between #2 Feb 2006# And #2 April 2006#

    The between operator is inclusive. the above espression is equivalent to: >= #2 Feb 2006# And <= #2 April 2006#

    To do what you are asking, I normally use a custom dialog. The dialog has a from date and a to date and the user enters/selects one or both. Then, I build the required expression in VBA and pass that along to the form or report as a filter or as the record source for the form or report.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!

    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts