Results 1 to 8 of 8
  1. #1
    eacollie is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    10

    Date range

    How do I query a recordset containing [StartDate] and [EndDate] for records with dates in between these?

    For example, if I have a record with [StartDate] = 06/02/2011 and [EndDate] = 06/08/2011, how do I capture this in a query where I'm looking for records from 06/05/2011 to 06/11/2011?

    Thanks!

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529

    For example, if I have a record with [StartDate] = 06/02/2011 and [EndDate] = 06/08/2011, how do I capture this in a query where I'm looking for records from 06/05/2011 to 06/11/2011?
    Are you looking for

    1. all records starting between those dates?
    2. all records ending between those dates?
    3. only those records having a start between those dates and an end between those dates.

    Depending on what you desire will dictate the criteria. Your explanation of what you want is a little vague.

    Alan

  3. #3
    eacollie is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    10
    Thanks alansidman.

    These records are for events.

    For example, if I have an event with [StartDate] = 05/01/2011 and [EndDate]= 06/02/2011

    and I want to look at the events for the week of 05/22/2011 to 05/28/2011, I want this event to display because it falls within this date range (5/22-5/28).

    Is there a function that allows me to do that?

  4. #4
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    So you want to see all events starting during that period and all events ending during that period.

    In the criteria for the StartDate put =>#5/22/2011#
    In the criteria for the EndDate on one line below the criteria above put =<#5/28/2011#

    Alan

  5. #5
    eacollie is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    10
    Thanks alansidman.

    In my example, the event doesn't start or end during that period of time. It starts before the selected date and ends after the selected date.

  6. #6
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    It would really help me understand what you are doing if you answered my earlier thread specifically.

    I am only guessing as you are not specific in what you want.

    Which of these applies

    Are you looking for

    1. all records starting between those dates?
    2. all records ending between those dates?
    3. only those records having a start between those dates and an end between those dates.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    So, by your description, in addition to the options listed by alan:
    4. records where the given date range is wholly within the event's range

    All of these scenarios must be considered. Do you want records that meet ANY of them?

    Check out this thread http://forums.devarticles.com/micros...ng-354178.html
    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.

  8. #8
    eacollie is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    10
    Thanks for the help. I think #1, #2, and #4 should cover all.

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

Similar Threads

  1. Date Range Parameter help!?!?
    By dkstech in forum Access
    Replies: 1
    Last Post: 01-15-2011, 11:05 AM
  2. Complicated Query needs some date range help
    By KevinMCB in forum Queries
    Replies: 1
    Last Post: 01-11-2011, 12:25 PM
  3. Date Range Failure
    By goodguy in forum Queries
    Replies: 4
    Last Post: 12-30-2010, 10:22 AM
  4. Date range help!!
    By bananatodd in forum Access
    Replies: 26
    Last Post: 10-18-2010, 01:57 PM
  5. Sum of Values over date range
    By bosnian in forum Queries
    Replies: 1
    Last Post: 01-12-2010, 03:41 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