Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate Field in a Query 1

Status
Not open for further replies.

primagic

IS-IT--Management
Joined
Jul 24, 2008
Messages
476
Location
GB
Hi

I have an automated calculated field which calculates a percentage of another field. This works perfectly, however my question is, is there a way I can limit the maximum percentage allowed to be calculated in this field.

For e.g

Field 1 Field 2 (caluclated field)
------- -------
10% 5%
20 10%

So the field 2 is half of field 1, but want I want to be able to do is, if the calculated amount is more than 5%, then round it down to 5%

Any help please
Thanks
 
Field2: IIf(Field1>=0.1,0.05,Field1/2)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Brilliant! Quick reply

Works perfectly. Thanks very much
 
primagic,
Brilliance and quickness rates handing out a star. A star not only rewards the TT member but gives a visual indicator that the thread has a successful conclusion.

Duane
Hook'D on Access
MS Access MVP
 
sure. but how does one put a star on the thread
 
Hi I came across a problem with the code given to me.

Code:
Field2: IIf(Field1>=0.1,0.05,Field1/2)

If the value is in field 2 is 8% then it gives me 4% but I can't have the calculated field go over 3%

But then if field 2 is 20% it gives me 3% instead of 10% which is what I need it to do. How come it works on some and not others?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top