Date Query

conormooney

Registered User.
Local time
Today, 13:40
Joined
Feb 17, 2004
Messages
35
I would like to know how to create a query which will allow me to select people who are over 18months old on the current date.
 
conormooney said:
I would like to know how to create a query which will allow me to select people who are over 18months old on the current date.
Look up DateDiff

Col
 
bit more detail please i am a novice!!
 
i have done that already, it only gives me a date diff function example which is no help 2 me
 
I'l explain this in more detail in case you do not understand

I have two fields in my query:
Cow ear tag number, Date of Birth

i want the query to select all those animals older than 18 months, could you give me the criteria for this please.
 
In the query grid in a new field put this

Age DateDiff("m",[YourDateOfBirthField],Date())

then in the criteria put

> 18

Col
 
when i run this query it asks me to enter a date of birth, i want the query to automatically select those animals over 18months old and display them in table?
 
You have to set the part in square brackets to the field that contains the animal's date of birth.
 
Could someone create a query to display all the animals above 18 months in a query called "18months+"

thank you
 

Attachments

Here you go.

One think I will say - taking a step away from the query (but it will affect your queries) - I think you have made a bad decision by giving your primary keys a Text data type.

Text takes up a hell of a lot of memory than a long number (autonumber) and when indexing on joins the speed will become noticeable as your database grows. I think you'd be best to create an autonumber field for your primary key and, for the fields you have currently as the primary key, to be indexed with no duplicates.
 

Attachments

Users who are viewing this thread

Back
Top Bottom