473,480 Members | 1,852 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Criteria on a derived field

77 New Member
Hi,

I have a column in my query that derives Age like this,
Age: DateDiff("yyyy",[birth date],[Entry Date]).
I tried giving a value '18' as the criteria and its not letting me do it. Without the criteria everything works fine.

I am sure someone might have come across similar situation, please help me with your findings.

Thanks
Jan 23 '08 #1
2 2775
missinglinq
3,532 Recognized Expert Specialist
Are you entering it as

'18'

as you posted or simply

18


The 18 without the single quotes should work, assuming the names of the two fields are spelled correctly.

What exactly happens when you try to run the query with the criteria?

When you run it without the criteria, does it return ages according to the calculation?

Does anyone have an age of 18?

As an aside, your formula may work in your current application, depending on your needs, but it doesn't always return an accurate age. It returns the difference
of years, but doesn't take into account whether or not the person has had their birthday for the [Entry Date] year.

Linq ;0)>
Jan 23 '08 #2
AccessHunter
77 New Member
Are you entering it as

'18'

as you posted or simply

18


The 18 without the single quotes should work, assuming the names of the two fields are spelled correctly.

What exactly happens when you try to run the query with the criteria?

When you run it without the criteria, does it return ages according to the calculation?

Does anyone have an age of 18?

As an aside, your formula may work in your current application, depending on your needs, but it doesn't always return an accurate age. It returns the difference
of years, but doesn't take into account whether or not the person has had their birthday for the [Entry Date] year.

Linq ;0)>

Let me explain what I am doing,

I have Birth Date as one of the columns in my query. Using Mon([Birth Date]) and Day([Birth Date]) I get the Birth Month and Birth Day for every record. I also ask for the Year from the user. Using the Year they enter, I derive Entry Date= DateSerial([Year],[Birth Month],[Birth Day]).
Then in the next column I calculate Age= DateDiff("yyyy",[Birth date],[Entry Date]).
Without giving any criteria it calculates the Age correctly in years, but when I give 18 or '18' as criteria I get a pop up to enter the Entry Date, which is not what I want.

Deriving the Entry Date as I explained above, my idea was to calculate the age on the birth day itself on the year entered by the user.
For example if the user entered 2005, for a person whose Birth Date = 01/04/1987, the Entry Date will be 01/04/2005 according to my method.

Sorry if I confused everybody,

Thanks
Jan 23 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
5251
by: AAVF | last post by:
Hi We have a problem with a query. An Access database links via ODBC to a UNIX server. To speed things, we use the ODBC to load the relevant tables to the local PC that runs Access so that...
3
11049
by: pelcovits | last post by:
I am trying to set up an unbound form to enter report criteria. I've followed the MS Office Assistance document: "Create a form to enter report criteria" which describes how to enter data (such...
1
3365
by: S. van Beek | last post by:
Dear reader, How can I filter a numeric field with Like as criteria in a query. To filter a numeric field with <10 as criteria this will com back with the result of those records for which...
0
2155
by: MLH | last post by:
I have an A97 query (qryVehiclesNowners2) that has a table field in it named . Depending on the selections made in a number of criteria choices on a form, a field on the form will have string...
3
3279
by: MLH | last post by:
Am repeating question with different subject heading, perhaps stating more clearly my problem... I have an A97 query (qryVehiclesNowners2) that has a table field in it named . Depending on the...
5
1896
by: jillandgordon | last post by:
I hope this group does not mind the most basic questions. I am trying to teach myself Access in two different versions. My company now uses Access 97 but, in the next few months, will be...
15
3810
by: Bob Johnson | last post by:
I have a base class that must have a member variable populated by, and only by, derived classes. It appears that if I declare the variable as "internal protected" then the base class *can*...
2
1757
by: sconard | last post by:
I cannot seem to refer to a derived field in criteria. Better phrased: I cannot refer to a derived field in the where clause of the query. The following does not use the value from the derived...
17
5640
by: sharsy | last post by:
Hello guys, I would like some help in generating query criteria that will identify credit cards that have expired on an access database. The specific Field is formatted with a Data Type of...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7037
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6735
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5326
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4770
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4476
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2992
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
176
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.