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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access date range help

Status
Not open for further replies.

josheppi

Technical User
Aug 18, 2005
4
0
0
US
I have a table with a date range (name, date1, date2, diff). I would like to list out all the dates between the range beginning with date1 but not including date 2. So if date1=1/1/05 and date2=1/5/05, I would like get the following info:

col1 col2
name 1/1/05
name 1/2/05
name 1/3/05
name 1/4/05

listed out in a query window or table. Thanks in advance for your help. Josheppi
 
listed out in a query window or table
If you just want to list the results on screen then you can simply add them to a listbox:

[TT]
date1 = #1/1/2005#
date2 = #1/5/2005#

d = date1

lst.RowSourceType = "Value List"
lst.RowSource = d

Do While d < date2 - 1
d = d + 1
lst.RowSource = lst.RowSource & "," & CStr(d)
Loop
[/TT]

Geoff Franklin
 
Geoff:

Thanks for reply. I am using MS Access and seem to lack some of the functionality used in your example. Also, I have a table with hundreds of records with date ranges. Do you think I can still define date1 = [RCT].admit_date?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top