PC Review


Reply
Thread Tools Rate Thread

Calculated field with criteria

 
 
John
Guest
Posts: n/a
 
      26th May 2004
I have a calculated field which I also add a criteria to. When I run the
query, it throws up a parameter dialog box looking for calculated field. I
tried removing the [] brackets around the calculated field name in the where
clause, but that did not help. Can one use a criteria on a calcuated field?
Thanks


 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      26th May 2004
Effectively, you need to repeat the entire expression for the calculated
field in the WHERE clause.

The way Access works, it first selects the records, and then calculates the
field. Naturally enough, you cannot place a condition on a field that has
not yet been calculated.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a calculated field which I also add a criteria to. When I run the
> query, it throws up a parameter dialog box looking for calculated field. I
> tried removing the [] brackets around the calculated field name in the

where
> clause, but that did not help. Can one use a criteria on a calcuated

field?
> Thanks



 
Reply With Quote
 
Elwin
Guest
Posts: n/a
 
      26th May 2004
If you don't want to repeat the calculation in your where
clause you could save the query without the where clause,
then base a 2nd query on the first, where you could simply
refer to the expression name assigned to the calculation.
good luck.

>-----Original Message-----
>I have a calculated field which I also add a criteria to.

When I run the
>query, it throws up a parameter dialog box looking for

calculated field. I
>tried removing the [] brackets around the calculated

field name in the where
>clause, but that did not help. Can one use a criteria on

a calcuated field?
>Thanks
>
>
>.
>

 
Reply With Quote
 
John
Guest
Posts: n/a
 
      26th May 2004
Allen Browne and Elwin - Thank you both for the valuable comments!

My calculated field was a custom function whose parameters were from other
calculated fields. When I rewrote the Where cause using your suggested "you
need to repeat the entire expression for the calculated field in the WHERE
clause," it worked just fine! The idea is that nowhere in the Where clause
should there appear the name of the calculated field - even for arguments to
functions. One should only use the expression which created the calculated
field as you suggested.

Thank you for clarifying that
"The way Access works, it first selects the records, and then calculates the

field. Naturally enough, you cannot place a condition on a field that has

not yet been calculated."


I hope you place this valuable information in the tips section of your
website.

Take care,
John

"John" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a calculated field which I also add a criteria to. When I run the
> query, it throws up a parameter dialog box looking for calculated field. I
> tried removing the [] brackets around the calculated field name in the

where
> clause, but that did not help. Can one use a criteria on a calcuated

field?
> Thanks
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Criteria for calculated field TeeSee Microsoft Access Form Coding 5 1st Jan 2008 11:36 AM
Criteria in a calculated field =?Utf-8?B?amx3?= Microsoft Access Queries 8 10th May 2006 04:31 PM
Criteria in calculated field =?Utf-8?B?YWhlYXJu?= Microsoft Access Queries 3 17th Apr 2006 08:16 PM
criteria on calculated field =?Utf-8?B?Q0pC?= Microsoft Access Queries 3 18th Feb 2006 04:57 PM
Criteria on field calculated form another calculated field Max Moor Microsoft Access Queries 1 22nd Dec 2004 08:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:43 PM.