Solved

Access Query: Count number of records in each week

Posted on 2006-11-27
10
946 Views
Last Modified: 2012-06-21
Good afternoon,
     I would like to create a query that counts the number of records in another query grouping them what week the records were entered.  I know how to do the grouping and counting, but I don't know how to tell what week the record was entered.  Please tell me how to add a field to my current query that will tell me what week the record was entered.  I would like the weeks to start on Thursdays, and end on Wednesdays, and I would like the field to be named [Week].  The name of the query is [qry_master], the date field in my query is [DateAcpt], and the table the query is pulling from is named [tbl_Main].  Thank you in advance for your help, and please be aware that I am somewhat of a novice user.  I need this ASAP, and I will be very grateful to the person that helps me out.  Thanks, Jon.
0
Comment
Question by:JBredensteiner
10 Comments
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
u can use the format command on a date to return the week number
eg

format(somedatefield,"ww")

0
 
LVL 8

Expert Comment

by:Jillyn_D
Comment Utility
Hi JBredensteiner,

Just add a date field to the table and set its default value to Date()

Good luck!
~Jillyn
0
 
LVL 4

Expert Comment

by:Clothahump
Comment Utility
0
 

Author Comment

by:JBredensteiner
Comment Utility
Did I mention that I was a novice user?

I have no idea of how to use the first suggestion.  When I put format(somedatefield,"ww") in the format field it changes to "for"m"at("s\om\ed"atefiel"d",ww)" Simply formating the date is not going to help as it won't help me to start the week on Thursday, and end on Wednesday, plus I would like it to return the week range i.e. 11/30/2006 - 12/06/2006, so I actually know what week it is talking about.  Returning the week number will not help at this point.  Thank you for your help though.

I don't believe the second suggestion will help me, or at least I don't see how it would.  Thank you too for your help.

As for the third suggestion, it looks like it could help, but I don't know how to call the module into my query once I create.

Here is some helpfull information I found, but I'm not sure how to use it, or if they are talking about putting the code into a report or a query.

http://www.experts-exchange.com/Databases/MS_Access/Q_21393779.html?query=access+week+report&clearTAFilter=true
0
 

Author Comment

by:JBredensteiner
Comment Utility
There is also this post, but again, I don't know how to use it.  Please help
http://www.experts-exchange.com/Databases/MS_Access/Q_21734617.html?query=access+week+report&clearTAFilter=true
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:JBredensteiner
Comment Utility
Please help
0
 

Author Comment

by:JBredensteiner
Comment Utility
Does anyone know how to accomplish this?  Please help it is very important that I figure this out.  Thanks again,
0
 
LVL 9

Accepted Solution

by:
Volibrawl earned 500 total points
Comment Utility
Enter this formula into  a new column in your queries.  This will give you the ENDING Date of that week (Wednesday).  

Weekfinish: IIf(Weekday([Date_acpt])<5,DateAdd('d',4-Weekday([Date_Acpt]),[Date_Acpt]),DateAdd('d',11-Weekday([Date_Acpt]),[Date_Acpt]))

To get the start, just add another column WeekStart:[weekfinish]-6


You can then group by either of these fields to get your totals for the week.
0
 

Author Comment

by:JBredensteiner
Comment Utility
You are the man, or woman, whichever it may be :)
Thank you so much for your help :)
0
 
LVL 9

Expert Comment

by:Volibrawl
Comment Utility
Thanks ... hope it helped.

Larry
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now