Generating Date Ranges

G

Guest

Hi,

I am developing a scheduling system, I get stuck with the generation of
dates though.

I have a table with the following fields, ID & Date. I would like to select
two dates on a form frmDateGenerate, a start date field called txtstartdate
and a end date field called txtenddate. When you select these two dates and
press a button, dates between the two dates selected should automatically be
generated and written in the table, this will basically happen on a monthly
basis.

Is this posible ??

Please Help !!

Thanx
 
G

Guest

Create a table with number field and populate with consecutive number zero
through the maximum difference that you will ever have between the dates.

Use the SQL statement below --

SELECT CVDate([Enter start date])+[Count] AS [My Dates]
FROM [Count]
WHERE (((CVDate([Enter start date])+[Count])<=CVDate([Enter end date])));
 
J

John Vinson

Hi,

I am developing a scheduling system, I get stuck with the generation of
dates though.

I have a table with the following fields, ID & Date. I would like to select
two dates on a form frmDateGenerate, a start date field called txtstartdate
and a end date field called txtenddate. When you select these two dates and
press a button, dates between the two dates selected should automatically be
generated and written in the table, this will basically happen on a monthly
basis.

Is this posible ??

Please Help !!

Thanx

One way to do this is to have an auxiliary table, AllDates, with just
one date field as its Primary Key. You can quickly generate such a
table in Excel, using its fill-down feature; just put in five years'
or so of valid dates in the range you want, and copy and paste it into
a table in Access.

You can then create an Append query based on this table, using a
criterion on its datefield of

BETWEEN [Enter start date:] AND [Enter end date:]

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top