Results 1 to 3 of 3
  1. #1
    cwjonss is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Mar 2019
    Posts
    2

    Using Query to filter a form for BETWEEN two date ranges

    I’m simply trying to filter a form for a date range between two dates, which are determined by two controls on a separate form.

    As I can seem to filter the form for dates after a date specified in a control:

    >[forms].[front.form].[after_date]



    I would have thought I could simply use:
    Between >[forms].[front_form].[after_date] and <[forms].[front_form].[before_date]

    But that tells me the date value is invalid in the query.

    I’ve tried:
    >[forms].[front_form].[after_date] and <[forms].[front_form].[before_date]

    which works but seems to only filter for the [before.date] range.

    Any help would be greatly appreciated!

  2. #2
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    You were close - with the Between construct you lose the < > operators as they are implied. Try

    Code:
    Between [forms].[front_form].[after_date] And [forms].[front_form].[before_date]
    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
    cwjonss is offline Novice
    Windows 7 32bit Access 2013 32bit
    Join Date
    Mar 2019
    Posts
    2
    wow, cannot believe I didn't try that. Must have spent 2 hours trying to figure this out!

    Absolute lifesaver, thanks for the help!

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

Similar Threads

  1. Replies: 3
    Last Post: 09-28-2015, 08:17 PM
  2. Date Between Ranges for SQL Query
    By BigSloppyJoes2000 in forum Queries
    Replies: 7
    Last Post: 02-13-2014, 05:09 PM
  3. Replies: 5
    Last Post: 12-12-2013, 12:14 PM
  4. Query by date for multiple ranges
    By Xarkath in forum Queries
    Replies: 2
    Last Post: 06-11-2013, 01:47 PM
  5. Query for gaps in date ranges
    By kagoodwin13 in forum Queries
    Replies: 6
    Last Post: 03-19-2012, 07:00 PM

Tags for this Thread

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