Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

enter start and end date and get all dates between

Status
Not open for further replies.

MikeydJR

Technical User
Sep 10, 2003
8
US
I'm trying to create a form where I enter a start date and end date and get all dates between
EX:
start date 8/1/03
end date 8/7/03

Returns

8/1/03 8/2/03 8/3/03 8/4/03 8/5/03 8/6/03 8/7/03

TIA for any advice.
 
Assuming you have a "Dates" field in the table that you store the data, and they are all formatted the same then you can have a query where under the criteria for the dates field have:

Code:
between [START DATE] and [END DATE]

When this is ran you will be asked for a start date, and an end date. Access will then display all dates that are in the table between the criteria you enter.

If you were after a way to do this without having every single date entered into a table then I suggest you re-post in the VBA forum (Forum707). I'm still classed as a newbie with VBA so I cannot help!

Hope this helps and Good Luck,


Steve.
If a post help you out then give it a star!
 
A not very documentet way is:

Sub dates()
dim lCounter as long
for lCounter = Me("txtStartDt") to Me("txtStopDt")
Debug.Print Format(lCounter, "m/d/yy")
next lCounter
End Sub

(you could of course add the dates to a control on a form, or whatever...)

HTH Roy-Vidar
 
Thanks, Steve. I think I will repost in the VBA forum. I need the resulting dates to be in a table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top