Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date problem in Access query

Status
Not open for further replies.

DaJoin

Technical User
Sep 15, 2002
9
BE
All,

I try to make a query to show only records of people that are born in the next week .

I found something working like this :

SELECT members.*
FROM members
WHERE (((DatePart("y",[members].[BirthDate])) Between DatePart("y",Date()) And DatePart("y",Date())+7));


Is there a better way to do this?
Can you add weeks or months to an access date in a query ?

I know you can in Oracle, but do not know how to do it in access SQL .
 
The funcion DateAdd() returns a date to which a specific time interval has been added. It would look something like this:

SELECT members.*
FROM members
WHERE [members].[birthdate] Between Date() And DateAdd("ww",1,Date());

If you wanted to add months use "m" instead of "ww".
 
Thanks, the DateAdd function is what I was looking for.
Is there a way to use this to compare dates only regarding the day and month (without year) ?

Reason to do this is to compare the month and day of a birthdate with the actual day and month.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top