Working with Dates in Access

G

Guest

I would like to have MSACCESS enumerate dates between a start date and an end
date. I have not worked with VBA code, can this be done via queries?
 
J

John Vinson

I would like to have MSACCESS enumerate dates between a start date and an end
date. I have not worked with VBA code, can this be done via queries?

Just what do you mean by "enumerate"? List all of the dates, return
all of the records where a datefield is in that range, or what?

If the former, you can use a query with the help of an auxiliary
table. I routinely put a table named NUM in my databases, with one
field N, with values from 0 to 10000 or so. You can get all the dates
in a range using a query

SELECT DateAdd("d", [N], [Enter start date:])
FROM Num
WHERE DateAdd("d", [N], [Enter start date:]) <= [Enter end date:];


John W. Vinson[MVP]
 
G

Guest

Thank you. I was on the right path, I have a number table created. Yes the
answer is list all of the dates between. I just didn't know how to say it.

Your help is appreciated.
Nora

John Vinson said:
I would like to have MSACCESS enumerate dates between a start date and an end
date. I have not worked with VBA code, can this be done via queries?

Just what do you mean by "enumerate"? List all of the dates, return
all of the records where a datefield is in that range, or what?

If the former, you can use a query with the help of an auxiliary
table. I routinely put a table named NUM in my databases, with one
field N, with values from 0 to 10000 or so. You can get all the dates
in a range using a query

SELECT DateAdd("d", [N], [Enter start date:])
FROM Num
WHERE DateAdd("d", [N], [Enter start date:]) <= [Enter end date:];


John W. Vinson[MVP]
 
G

Guest

Hi John
This is something I have been stumbling on for some time, can you be more
specific?
I have a reservation database with [FirstNight] & [LastNight] fields in.
I need to extract the dates inbetween for use in a crosstab grid.
Any help?
regards Struan

John Vinson said:
I would like to have MSACCESS enumerate dates between a start date and an end
date. I have not worked with VBA code, can this be done via queries?

Just what do you mean by "enumerate"? List all of the dates, return
all of the records where a datefield is in that range, or what?

If the former, you can use a query with the help of an auxiliary
table. I routinely put a table named NUM in my databases, with one
field N, with values from 0 to 10000 or so. You can get all the dates
in a range using a query

SELECT DateAdd("d", [N], [Enter start date:])
FROM Num
WHERE DateAdd("d", [N], [Enter start date:]) <= [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