run query for the system day

G

Guest

Hi Guys,
I need to now redo the below SQl to show not todays date but one week from
today to send out birthday cards etc, can anyone help me please?

Cheers Mark
SELECT [All New Data].[Ref #], [All New Data].[First Name],
[All New Data].[Last Name], [All New Data].DOB,
[All New Data].Address, [All New Data].Suburb,
[All New Data].State, [All New Data].Postcode,
Month(DOB) AS BirthMonth, Day(DOB) AS BirthDay
FROM [All New Data]
WHERE Month(DOB)=Month(Date()) AND Day(DOB)=Day(Date())
 
M

Marshall Barton

Mark_Milly said:
I need to now redo the below SQl to show not todays date but one week from
today to send out birthday cards etc, can anyone help me please?
SELECT [All New Data].[Ref #], [All New Data].[First Name],
[All New Data].[Last Name], [All New Data].DOB,
[All New Data].Address, [All New Data].Suburb,
[All New Data].State, [All New Data].Postcode,
Month(DOB) AS BirthMonth, Day(DOB) AS BirthDay
FROM [All New Data]
WHERE Month(DOB)=Month(Date()) AND Day(DOB)=Day(Date())


Although it may be poor form, this should do that.
WHERE Month(DOB-7)=Month(Date()) AND Day(DOB-7)=Day(Date())

To be rigorous, you should use DateAdd("d", -1, DOB) instead
of DOB -7, but it's too much typing.
 
V

Van T. Dinh

Perhaps, you can try:

SELECT [All New Data].[Ref #], [All New Data].[First Name],
[All New Data].[Last Name], [All New Data].DOB,
[All New Data].Address, [All New Data].Suburb,
[All New Data].State, [All New Data].Postcode,
Month(DOB) AS BirthMonth, Day(DOB) AS BirthDay
FROM [All New Data]
WHERE DatePart("y", DOB) =
DatePart( DateAdd( "d", 7, Date() ) )


--
HTH
Van T. Dinh
MVP (Access)



Mark_Milly said:
Hi Guys,
I need to now redo the below SQl to show not todays date but one week from
today to send out birthday cards etc, can anyone help me please?

Cheers Mark
SELECT [All New Data].[Ref #], [All New Data].[First Name],
[All New Data].[Last Name], [All New Data].DOB,
[All New Data].Address, [All New Data].Suburb,
[All New Data].State, [All New Data].Postcode,
Month(DOB) AS BirthMonth, Day(DOB) AS BirthDay
FROM [All New Data]
WHERE Month(DOB)=Month(Date()) AND Day(DOB)=Day(Date())
 

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