Results 1 to 8 of 8
  1. #1
    need_help12 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    58

    Date Range Query

    Good afternoon.



    I'm working on a db that contains contracts data, and I need the ability to pull contracts that are expiring between a chosen "StartDate" and "EndDate".

    I've created a form that allows end users to search for contracts expiring between a chosen start and end date, with a command button to run the report.

    In the qry for this report, in the Contract STart Date field I have a listed criteria of "<[Forms]![frmContractTracking]![EndDate]" and on the Contract End Date field I have a listed criteria of ">[Forms]![frmContractTracking]![StartDate]"

    Currently, this is returning all field in the table, regardless of dates I enter on the Form. I've been staring at this too long, and I'm hoping someone with fresh eyes can assist.

    Any help is greatly appreciated.

    Thanks!

  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
    Based on your description, you'd want this in the end date criteria:

    Between [Forms]![frmContractTracking]![StartDate] And [Forms]![frmContractTracking]![EndDate]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    need_help12 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    58
    immediately fixed. Thanks again for your help, Paul!

  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
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    need_help12 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    58
    Actually, a quick follow-up, Paul. Everything works perfectly. For the report header, is there a way to show the range of dates the end user input? For example, if the end user inputs on the frm "4/1/12" - "4/30/12" and reuns the report, the report head states "Contracts Expiring Between [StartDate] - [EndDate]?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sure, you just concatenate the form references into a string. A textbox control source of:

    ="Contracts Expiring Between " & [Forms]![frmContractTracking]![StartDate] & " - " & [Forms]![frmContractTracking]![EndDate]
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    need_help12 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    58
    I'm going to have to put you on retainer Thanks, Paul!

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help. I accept both beer and nice red wines as retainer fees.

    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. Query with multiple date range constraints.
    By younggunnaz69 in forum Queries
    Replies: 2
    Last Post: 12-26-2011, 10:45 AM
  2. Run query by date range
    By ARickert in forum Access
    Replies: 2
    Last Post: 06-23-2011, 10:54 AM
  3. Complicated Query needs some date range help
    By KevinMCB in forum Queries
    Replies: 1
    Last Post: 01-11-2011, 12:25 PM
  4. Date range query from form
    By Steve Barnes in forum Queries
    Replies: 2
    Last Post: 07-29-2010, 07:06 PM
  5. Query for date range from two column?
    By sunny in forum Queries
    Replies: 2
    Last Post: 07-28-2010, 07:12 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