Results 1 to 4 of 4
  1. #1
    Acegundam is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    3

    Working with date ranges

    I am having an issue calling date ranges. The main purpose of my database is to keep track of all time off requests from my employees. Our weeks run Sunday through Saturday. So I have to two fields and the first field is start date and the second field is end date.

    Here's my problem:

    Jim Jones requested 11/4/2011 - 11/6/2011 off. (11/4/2011 is in field 1 and 11/6/2011 is in field 2)

    So I want to call everyone who has time off between 11/6/2011 - 11/12/2011 to see who has requested time off for next week. What would be the best way of doing this?

    I tried putting in Between #11/6/2011# And #11/12/2011# but because Mr Jone's start date is before 11/6/2011 his record is not being called into the query. I'm trying to avoid putting in a start date that is before the beginning of the week because I don't want old records being pulled.

  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,652
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Acegundam is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    3
    That is exactly what I need, but I don't have much experience in access so where would I put that SQL string?

  4. #4
    Acegundam is offline Novice
    Windows XP Access 2007
    Join Date
    Nov 2011
    Posts
    3
    Ok, so I learned that the only line I need to edit is WHERE OffStartDate <= Forms!FormName.txtEndDate And OffEndDate >= Forms!FormName.txtStartDate

    Here is the rest of the SQL strings I have in my query, if that helps SELECT [Time Off fields].[Last Name], [Time Off fields].[First Name], [Time Off fields].[Start Date], [Time Off fields].[End Date], [Time Off fields].Reason
    FROM [Time Off fields]
    WHERE ((([Time Off fields].[End Date]) Between #11/6/2011# And #11/12/2011#));

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

Similar Threads

  1. Replies: 2
    Last Post: 09-13-2011, 11:21 AM
  2. Date ranges using Calendar control
    By LilMissAttack in forum Forms
    Replies: 8
    Last Post: 08-25-2011, 10:04 AM
  3. Query return for date ranges.
    By Desstro in forum Queries
    Replies: 2
    Last Post: 09-14-2010, 06:44 AM
  4. Select Query Using Different Date Ranges
    By Hemi426 in forum Queries
    Replies: 3
    Last Post: 07-26-2010, 01:06 PM
  5. summing values associated with date ranges
    By wdemilly in forum Reports
    Replies: 0
    Last Post: 07-17-2009, 01:53 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