How to determine the numeric value of a date field?

H

harnish

I'm using Access 2000 and have a db with some queries set up by
someone else. The query is supposed to list those who are of a
certain age:

For those who have a dob that makes them 16 years old plus the query
is:

<(Now()-5844)

For those who have a dob in the age range of 16 years old:

Between (Now()-5475) And (Now()-5843)

How do I work backwards to determine what the 5844 and the 5843 are
supposed to be so I can double-check the results? As it stands now, I
have a known 17 year old not showing up on the 16+ list.

Thanks for any help you can provide!

LH
 
J

Jeff Boyce

One way to calculate age would be to calculate the number of days between
DOB and the current date.

You can confirm the accuracy of the calculation by determining how long 5844
days is, in years. ... and 5475 and 5843.

By the way, the Now() function returns the current date AND TIME. The
Date() function might be more appropriate, as it returns the current date.
So your first calculation asks, roughly, for DOBs that happened more than
5844 days ago.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
R

RBear3

Why not simplify it a bit? Add a new column to your query to pull up the
person's age, then evaluate that.

To calculate age, put a new column like...

Age:
DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date(),"mmdd"))

Then you can put criteria under that such as...
16 for (older than 16)

Or, you can ask the user to specify...

[Enter Minimum Age]
 
R

RBear3

Note that in my previous post, you could pull only those who are exactly 16
with criteria under your new column of...

=16
 

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