between date and date

J

Jason

Hi,

I would like to create a query based on 2 dates. That is the part i know.
The hard part is how do i get the results if i don't want to include the
weekends.

For example, i want to get a list of all my expenses from 24-12-2004
(sunday) to 24-01-2005 (monday). The 24th is the day when i get my payments.
If the 24th of the startdate falls in the weekend, then i should get the
previous workday. If the enddate falls in the weekend then i should get the
next workday.

Is this possible?
 
P

Per Larsen

Jason said:
Hi,

I would like to create a query based on 2 dates. That is the part i know.
The hard part is how do i get the results if i don't want to include the
weekends.

WHERE MyDate between Date1 and Date2
and Weekday(MyDate) Not In (vbSaturday, vbSunday)

Hth
PerL
 
P

Per Larsen

Jason said:
Hi,

I would like to create a query based on 2 dates. That is the part i know.
The hard part is how do i get the results if i don't want to include the
weekends.

WHERE MyDate between Date1 and Date2
and Weekday(MyDate) Not In (vbSaturday, vbSunday)

The previous reply went out a bit too fast to add the fact that if your dates (MyDate) includes time of day, you need to add the time portion of the 'newest' date, as '24-01-2005 23:59:59'.

Regards
PerL
 

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