how do I extract the date between two date fields in Access

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have made a reservations database in ms access.
It has two fields which are [FirstNight] and [LastNight] and for various
reasons I need to extract, using a query, the dates inbetween in "dd/mm/yyyy"
format. can anyone help??
 
Hi Struan,

the only way to use a query for this is to create a table
with all the dates listed and use criteria to get just dates
between your beginning and ending dates.

are you trying to put these dates into a table or just
display them?

if you are creating records for a table, you can write code
to do append queries for each day between the dates, or open
the table and create a new record for each day

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 
Create a table named TblNumbers with onr field named Num. Fill the table
with sequential numbers from 1 to the maximum nomber of days you think there
will be between [FirstNight] and [LastNight]. Create a query that includes
TblNumbers and your reservation table. Create a calculated field that looks
like:
ReservationDates:[FirstNight] + [Num]
Put the following expression in the criteria of the calculated field:
Between [FirstNight] And [LastNight]
When you run the query you will get all the dates between {FirstNight] and
[LastNight]
 
PC Datasheet said:
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
(e-mail address removed)

--
To Steve:
Over 400 users from the newsgroups have visited the website to read what kind of a 'resource' you are...

To the original poster:

Most people here have a common belief that the newsgroups are for *free exchange of information*.
But Steve is a notorious job hunter in these groups, always trying to sell his services.
Also he gives LOTS of stupid or wrong answers.

Before you intend to do business with him look at:
http://home.tiscali.nl/arracom/whoissteve.html

Arno R
 
To the original poster:

It is commonly accepted that these newsgroups are for free exchange of
information. Please be aware that PC Datasheet is a notorious job hunter.
If you are considering doing business with him then I suggest that you take
a look at the link below first.


http://home.tiscali.nl/arracom/whoissteve.html



PC Datasheet said:
Create a table named TblNumbers with onr field named Num. Fill the table
with sequential numbers from 1 to the maximum nomber of days you think there
will be between [FirstNight] and [LastNight]. Create a query that includes
TblNumbers and your reservation table. Create a calculated field that looks
like:
ReservationDates:[FirstNight] + [Num]
Put the following expression in the criteria of the calculated field:
Between [FirstNight] And [LastNight]
When you run the query you will get all the dates between {FirstNight] and
[LastNight]

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
Over 1125 users have come to me from the newsgroups requesting help
(e-mail address removed)


Struan said:
I have made a reservations database in ms access.
It has two fields which are [FirstNight] and [LastNight] and for various
reasons I need to extract, using a query, the dates inbetween in
"dd/mm/yyyy"
format. can anyone help??
 
Back
Top