Calculated control in Report Foooter

Access_Help

Registered User.
Local time
Today, 15:46
Joined
Feb 12, 2005
Messages
136
Hi,

I have a report and in the footer I have added a text box (Textbox136) to work out the average percentage of the field [Percentage], which works fine.

For the value in textbox136 I want to output a grade and want to use an IIF function in the control source, something like:



IIf([Textbox136]>=100,"A+",IIf([Textbox136]>=90,"A+",IIf([Textbox136]>=80,"A",IIf([Textbox136]>=70,"B",IIf([Textbox136]>=60,"C",IIf([Textbox136]>=50,"D",IIf([Textbox136]>=40,"E",IIf([Textbox136]>=30,"E-","U"))))))))

But it won't work.

Any ideas?
 
There are two ways you can do this - you can either calculate the grade number as part of the query the report is based on and bind the control to that calculated field, or you can calculate it in the control itself.

My suggestion would be the first one. Just use the same syntax
Code:
GradeNum: ConvertGradeToPercentage([CWGRADE])
in the query that you did in the other one, and then set the control's control source to GradeNum.

Optionally, you can leave the underlying query alone, and just change the control source property for that one control to
Code:
=ConvertGradeToPercentage([CWGRADE])
.

Obviously, for either method, you need CWGRADE to be in the query the report is based on. We would, of course, be re-using the ConvertGradeToPercentage function, but as long as you made sure it's PUBLIC and not PRIVATE, it should be accessible.

I recommend the first one simply because it will be a bit faster.
 

Users who are viewing this thread

Back
Top Bottom