Birthdays

T

Tony Wainwright

Hi Guys
I have a database that lists personal details of people that live in the
same house. What I an trying to do is to print a list of approaching
birthdays 2 weeks in advance. I am using the following query:
SELECT [Title] & " " & [FirstName] & " " & [LastName] AS Name, [NoName] & "
" & [Street] AS Thoroughare, tblAddress.Locality, tblAddress.Town,
tblAddress.County, tblAddress.PostCode, Left([DOB],6) & Right(Date(),4) AS
DateRange, Date() AS Expr1, Date()+14 AS Expr2
FROM tblPersonDetails INNER JOIN tblAddress ON
tblPersonDetails.ApplicationID = tblAddress.ApplicationID
WHERE (((Left([DOB],6) & Right(Date(),4)) Between Date() And Date()+14));

If I apply it to the following list and todays date is the 20/05/2005 (UK
Date) then I get those who birthdays are not in the next 2 weeks
i.e.everyone except Person B

Person A 16/03/1964
Person B 02/06/1961
Person C 10/10/1949
Person D 14/07/1984

Can anyone help me to change this
Thanks
Tony
 
P

Per Larsen

Tony said:
Hi Guys
I have a database that lists personal details of people that live in the
same house. What I an trying to do is to print a list of approaching
birthdays 2 weeks in advance. I am using the following query:
SELECT [Title] & " " & [FirstName] & " " & [LastName] AS Name, [NoName] & "
" & [Street] AS Thoroughare, tblAddress.Locality, tblAddress.Town,
tblAddress.County, tblAddress.PostCode, Left([DOB],6) & Right(Date(),4) AS
DateRange, Date() AS Expr1, Date()+14 AS Expr2
FROM tblPersonDetails INNER JOIN tblAddress ON
tblPersonDetails.ApplicationID = tblAddress.ApplicationID
WHERE (((Left([DOB],6) & Right(Date(),4)) Between Date() And Date()+14));

If I apply it to the following list and todays date is the 20/05/2005 (UK
Date) then I get those who birthdays are not in the next 2 weeks
i.e.everyone except Person B

Person A 16/03/1964
Person B 02/06/1961
Person C 10/10/1949
Person D 14/07/1984

Can anyone help me to change this
Thanks
Tony

Use DateDiff and Dateserial, something like:

WHERE DateDiff("d", Date(),DateSerial(Year(Now()),Month(DOB),Day(DOB))) Between 1 And 14

Hth
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