Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 06-04-2019, 12:26 PM   #16
Gasman
Enthusiastic Amateur
 
Gasman's Avatar
 
Join Date: Sep 2011
Location: Swansea, South Wales,UK
Posts: 4,363
Thanks: 434
Thanked 802 Times in 777 Posts
Gasman is a jewel in the rough Gasman is a jewel in the rough Gasman is a jewel in the rough
Re: List dates between date range

arnelgp offered a method a good while back that I used.
You have 3 tables, for day, month,year. Day is 1 to 31, Month 1 to 12, Years, whatever years you want.

I have a form like you that has start and enddate (unbound) and a button that runs the query code below

Code:
INSERT INTO tblDates ( DayDate )
SELECT DateSerial([YearNo],[MonthNo],[DayNo]) AS Dates
FROM tblDay, tblMonth, tblYear
WHERE (((DateSerial([YearNo],[MonthNo],[DayNo])) Between [Forms]![frmGenerateDates]![txtStartdate] And [Forms]![frmGenerateDates]![txtEnddate]) AND ((IsDate([MonthNo] & "/" & [DayNo] & "/" & [YearNo]))<>False))
ORDER BY DateSerial([YearNo],[MonthNo],[DayNo]);
Works like TheDBguy's method I believe, that is with a Cartesian join.?

Perhaps you can tailor this. ?

HTH

__________________
Access novice. Sometimes trying to give something back.
Access 2007

Please, please use code tag # when posting code snippets

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Gasman is offline   Reply With Quote
Old 06-08-2019, 04:48 AM   #17
lookforsmt
Newly Registered User
 
Join Date: Dec 2011
Posts: 523
Thanks: 74
Thanked 2 Times in 2 Posts
lookforsmt is on a distinguished road
Re: List dates between date range

Thanks Gasman, would try that too.

Thank you all for all the support and advices

lookforsmt is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter by date range for any one of three dates. manderson_zim Modules & VBA 5 04-05-2011 07:00 AM
Show dates between a date range billwest Queries 0 12-09-2009 01:23 AM
Report Date Range showing all dates thunderbolt1164 Reports 29 03-15-2008 02:59 AM
It is possible to list all dates inbetween a date range? Please help joe789 Queries 3 08-20-2004 11:45 AM
Matching a date with a range of dates jvanderw Modules & VBA 1 01-24-2002 06:14 AM




All times are GMT -8. The time now is 04:35 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World