Solved

Access Query: Count number of records in each week

Posted on 2006-11-27
10
977 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
ID: 18022328
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
ID: 18022351
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
ID: 18022402
0
 

Author Comment

by:JBredensteiner
ID: 18022552
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
ID: 18022675
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:JBredensteiner
ID: 18023723
Please help
0
 

Author Comment

by:JBredensteiner
ID: 18030552
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
ID: 18031680
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
ID: 18033106
You are the man, or woman, whichever it may be :)
Thank you so much for your help :)
0
 
LVL 9

Expert Comment

by:Volibrawl
ID: 18039208
Thanks ... hope it helped.

Larry
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

920 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

14 Experts available now in Live!

Get 1:1 Help Now