Age Field in Form but Not Query

A

antmorano

Hello All:

I am currently in the process of creating a database based on retiree
information. I inputted all of my data into one main table and then
created queries from this table. I then created a form based on each
query. I needed Access to calculate the age of retirees so I followed
the directions from Access which explain that a text box needs to be
created in the form and then a formula is inserted in the
ControlSource. This turned out fantastic and I got the results that I
wanted. I realized that one of the reports that I need to create is
based on people being below the age of 65. When I go to create a new
query, in hopes of setting a filter for <65, age is not there b/c it
is only in the form. Does anyone know of a way that the retiree age,
once calculated, can be inserted in the query? I'm assuming that a
macro would be needed. If more information is needed I would be glad
to provide it. Hope to get some new ideas. Thanks again.

-Anthony Morano
Pension Fund Intern
 
F

fredg

Hello All:

I am currently in the process of creating a database based on retiree
information. I inputted all of my data into one main table and then
created queries from this table. I then created a form based on each
query. I needed Access to calculate the age of retirees so I followed
the directions from Access which explain that a text box needs to be
created in the form and then a formula is inserted in the
ControlSource. This turned out fantastic and I got the results that I
wanted. I realized that one of the reports that I need to create is
based on people being below the age of 65. When I go to create a new
query, in hopes of setting a filter for <65, age is not there b/c it
is only in the form. Does anyone know of a way that the retiree age,
once calculated, can be inserted in the query? I'm assuming that a
macro would be needed. If more information is needed I would be glad
to provide it. Hope to get some new ideas. Thanks again.

-Anthony Morano
Pension Fund Intern

Just calculate the age in the query, then use that column to filter
for ages under 65.

In a query, add a new column:
Age: DateDiff("yyyy", [DOB], Date()) - IIF(Format([DOB], "mmdd") >
Format(Date(), "mmdd"), 1, 0)

As criteria on this Age column, write:
<65
 
T

Tom Wickerath MDB

if you were using Access Data Projects then you shoudl use this column as a
calculated field-- then it's easy to manager and always accurate

using calculations like this in a query is short-sighted, because you can't
reuse that business logic





fredg said:
Hello All:

I am currently in the process of creating a database based on retiree
information. I inputted all of my data into one main table and then
created queries from this table. I then created a form based on each
query. I needed Access to calculate the age of retirees so I followed
the directions from Access which explain that a text box needs to be
created in the form and then a formula is inserted in the
ControlSource. This turned out fantastic and I got the results that I
wanted. I realized that one of the reports that I need to create is
based on people being below the age of 65. When I go to create a new
query, in hopes of setting a filter for <65, age is not there b/c it
is only in the form. Does anyone know of a way that the retiree age,
once calculated, can be inserted in the query? I'm assuming that a
macro would be needed. If more information is needed I would be glad
to provide it. Hope to get some new ideas. Thanks again.

-Anthony Morano
Pension Fund Intern

Just calculate the age in the query, then use that column to filter
for ages under 65.

In a query, add a new column:
Age: DateDiff("yyyy", [DOB], Date()) - IIF(Format([DOB], "mmdd") >
Format(Date(), "mmdd"), 1, 0)

As criteria on this Age column, write:
<65
 
6

'69 Camaro

Everyone please note that Aaron Kem.pf is attempting to impersonate one of
our regular posters again. Tom would never post such a message.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.


Tom Wickerath MDB said:
if you were using Access Data Projects then you shoudl use this column as
a calculated field-- then it's easy to manager and always accurate

using calculations like this in a query is short-sighted, because you
can't reuse that business logic





fredg said:
Hello All:

I am currently in the process of creating a database based on retiree
information. I inputted all of my data into one main table and then
created queries from this table. I then created a form based on each
query. I needed Access to calculate the age of retirees so I followed
the directions from Access which explain that a text box needs to be
created in the form and then a formula is inserted in the
ControlSource. This turned out fantastic and I got the results that I
wanted. I realized that one of the reports that I need to create is
based on people being below the age of 65. When I go to create a new
query, in hopes of setting a filter for <65, age is not there b/c it
is only in the form. Does anyone know of a way that the retiree age,
once calculated, can be inserted in the query? I'm assuming that a
macro would be needed. If more information is needed I would be glad
to provide it. Hope to get some new ideas. Thanks again.

-Anthony Morano
Pension Fund Intern

Just calculate the age in the query, then use that column to filter
for ages under 65.

In a query, add a new column:
Age: DateDiff("yyyy", [DOB], Date()) - IIF(Format([DOB], "mmdd") >
Format(Date(), "mmdd"), 1, 0)

As criteria on this Age column, write:
<65
 

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