run query for the system day

  • Thread starter Thread starter Guest
  • Start date Start date
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())
 
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.
 
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())
 
Back
Top