Results 1 to 4 of 4
  1. #1
    royalrochelle is offline Novice
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    13

    Group by Week for any given start date

    I apologize in advance if there is a similar post already solved up here but I have been searching for days and can't find what I am looking for.

    I am working on a database that is gathering information for people who are on a study. Each individual on the study is supposed to make 4 calls a day so there should be 28 calls for a week. If the person makes all 28 calls for a week they get a bonus. They can get a bonus every week they make 28 calls. datepart("ww",date()) is very close to what I want but this numbers the weeks by calendar year. Each individual can have a different start date. I would like the query to group by weeks but the week starting with the individual's start date. So if the person starts today I would like it to look something like this:

    Week Week Range Data


    Week 1 2/15/12 - 2/21/12 20
    Week 2 2/22/12 - 2/28/12 28

    I really don't need to see the date range but I just put that there so you can see what I am looking for. Is this possible? Someone please help before I pull all the hair out of my head!!

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    See Query8 in the attached db.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,891
    You will have us all pulling our hair out by the roots! Every person will have a different first day of the week dependent on their start day. The DatePart function has an argument to specify the first day of week. Use WeekDay function to determine the day of week of the start date and use that value to set the first day of week for the DatePart argument. Like:

    DatePart("ww", Date(), WeekDay([StartDate]))

    Could just prorate their first week so everyone is on the same weekly schedule.
    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.

  4. #4
    royalrochelle is offline Novice
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    13
    Thank you SOOOO much! This worked! Thank you both for taking time out of your day to help me! I really appreciate it.

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

Similar Threads

  1. Group by week
    By Grooz13 in forum Queries
    Replies: 4
    Last Post: 11-03-2011, 11:49 AM
  2. How to group by week
    By accessmatt in forum Reports
    Replies: 21
    Last Post: 09-28-2011, 09:40 AM
  3. Data group by week
    By hoachen in forum Access
    Replies: 2
    Last Post: 09-09-2011, 08:37 AM
  4. Replies: 1
    Last Post: 07-07-2010, 04:22 PM
  5. Group by Week in a Crosstab Query
    By NMJones in forum Access
    Replies: 1
    Last Post: 06-24-2010, 04:09 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