making a database and running date querys

B

bradhamblen

I need to make a query that will look for empolyee anniversary for the
next 30 days that will sort them into 1 year ,5 years and 10 years.
This has stumped me.

Hambone
 
T

Trever B

Hi Hambone,

Here is a starter,

In query make a check date made up as follows: A = Date of Start

dateSerial(Year(Now()),Month([A]),Day([A])

Now your have this years aniversary date.

Criteria = Between Now() and Dateadd("d",30,Now())

This has got all days within the next 30 days

In another field you can have Datediff("y",Now(),[A]) then sort on this
field to get sorted into years order. (Or make criteria = in(1,5,10)

Hope you understand this

Trev
 
Top