By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,529 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Between dates (dd-mm) query MS Access

P: n/a
HI,

I'm having a problem with the following query.

Here it is in my own words :

Table :
T_Test
id (Autonumber)
dtmStartDate (Datetime) format dd-mm
dtmEndDate (datetime) format dd-mm
intHours (number)

I want to query the T_Test table with a dd-mm value to get the right
intHours value where my dd-mm is between dtmStartDate and dtmEndDate.

Select intHours from T_Test where '25-05' between dtmStartDate and
dtmEndDate

Can someone help please?

Thanks

Alain
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
A date includes a date, month, and year. While you could use the format
command to format the field and criteria the same, it would return the month
and day, regardless of year. This will probably cause you a problem when you
continue to add records next year. The criteria will work properly if you
include the year also. If you simply want the current year, you can
concatenate that in.

Select intHours from T_Test where DateSerial(Year(Date()), 05, 25) between
dtmStartDate and dtmEndDate

--
Wayne Morgan
Microsoft Access MVP
"Alain Filiatrault" <al****@humaprise.com> wrote in message
news:45**************************@posting.google.c om...
HI,

I'm having a problem with the following query.

Here it is in my own words :

Table :
T_Test
id (Autonumber)
dtmStartDate (Datetime) format dd-mm
dtmEndDate (datetime) format dd-mm
intHours (number)

I want to query the T_Test table with a dd-mm value to get the right
intHours value where my dd-mm is between dtmStartDate and dtmEndDate.

Select intHours from T_Test where '25-05' between dtmStartDate and
dtmEndDate

Can someone help please?

Thanks

Alain

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.