Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
List of Weeks by Date
Michael Johnson 
        
3 years ago
How can I create a query to show a list of dates that are the beginning of each week based on a beginning and end date? For example, if I enter 5/1/23 and 6/30/24 I would want a list of the first day of each week (Monday in my case). 5/1, 5/8, 5/15, etc.. (Sorry, I haven't converted to the ISO date standard yet. I'd have to convert my whole department. Baby steps.) I thought this would be an easy thing to do, but for the life of me, I can't wrap my head around it. Chat GPT has been no help either.

The reason I want that list is so I can use it as a join in another query where I'm calculating hours for events per week and there are some weeks that have no hours, but I want to show those weeks with 0 hours in a report.
John Davy  @Reply  
         
3 years ago
Take a look at Richard's video Next Business Day and look at his links and Code
John Davy  @Reply  
         
3 years ago
Also Richard's video https://www.599cd.com/blog/display-article.asp?ID=2425
Michael Johnson OP  @Reply  
        
3 years ago
Hi John. Thank you for your response. I re-watched those videos, including the Extended Cut video of the Next Business Day video. Unfortunately that's not what I'm looking for. I'm looking to generate a list of dates not based off of any table, but only based off of the start date and end date of entered parameters. I forgot to mention the fact they are entered parameters in my original question. Ultimately the dates will be based off of something, but for now they're manually entered.

I do already have a query that takes the dates I have in a table and converts them to the start date of the week so I can run them through an aggregate query and sum up the event hours for that week. What I'm trying to accomplish is adding in those weeks where I don't have any events.

I've thought about using VBA and temporary tables, which I could do, but I was trying to see if I could do it through queries first, since I already have those built and would hopefully be simpler.
Kevin Yip  @Reply  
     
3 years ago
Hi Michael, you need a table to make that list.  Even if you make a query, you still need a table, because a query can't create records on its own.  A query needs a table to have multiple rows, such as in SELECT Field1 FROM Table1 -- if Table1 has N rows, that's how many rows the query has.  If you just write SELECT "something" As Field1, this query can only have one row.

You can make a table with a list of dates you want by manually entering them if there are not too many, or using VBA to populate the table with a starting date on a Monday, then subsequent dates that are 7 greater than the previous one.
Michael Johnson OP  @Reply  
        
3 years ago
Hi Kevin. Yeah, that's kinda what I was thinking. I figured I'd ask in case there was something that could calculate that list just with SQL that I wasn't aware of, but I may have to go with VBA to calculate the dates and populate a table with those dates when asked for the range.

It's something I COULD put in a table manually since it wouldn't take me that long for each year, but I'm trying to keep as many aspects automated/calculated as possible for this project.

Thanks!
Michael Johnson OP  @Reply  
        
3 years ago
I ended up creating a table and wrote VBA code to wipe the table, then insert in the weeks specified using a While loop and SQL.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 4:37:15 AM. PLT: 0s