Year Query

S

Sue

In a table containing employee information, I have a field
that shows birthdate as MM/DD/YY. How would I write a
query that I could use a parameter box that prompt me for
entering a particular year? An example would be wanting
to see everyone who was born in 1980. Thanks!
 
J

John Vinson

In a table containing employee information, I have a field
that shows birthdate as MM/DD/YY. How would I write a
query that I could use a parameter box that prompt me for
entering a particular year? An example would be wanting
to see everyone who was born in 1980. Thanks!

Two ways:

- Add a calculated field by typing

BirthYear: Year([birthdate])

in a vacant Field cell, and put a criterion on it of

[Enter year:]

- Or, to take advantage of indexes on the table, use just the
birthdate field with a criterion of
= DateSerial([Enter year:], 1, 1) AND < DateSerial([Enter year:] + 1, 1, 1)
 

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