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!

Dates qry

Status
Not open for further replies.

Affy

Programmer
Nov 27, 2001
9
GB
I have a set of dates:

Start date 01/01/01
End Date 06/03/01

What I need is to populate a table using these dates so it displays the following:

Start date End Date
01/01/01 31/01/01
01/02/01 28/02/01
01/03/01 06/03/01

Is this possible and how please help.

Thanks
 
I would do this in vba
I would open the table in an updateable recordset

I would then set four date fields

startdate = "01/01/01"
enddate = "06/03/01"
workstartdate = startdate
workenddate = "31/01/01"

then do something like this:

do

rs.insert
rs!startdate = workstartdate
rs!entdate = workenddate
rs.update

if workenddate = enddate then
done = true
else
workstartdate = dateadd("m", 1, workstartdate)
workenddate = dateadd("m", 1, workenddate)
if workenddate > enddate then
workenddate = enddate
end if
end if

do while not done

the syntax is most likely not exact but this should be close enough for you to get the rest.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top