Calculated Control in a Report

  • Thread starter Thread starter kdonnel1
  • Start date Start date
K

kdonnel1

Guest
I am designing a report. I want to include a box in there that is based on another box of information from an existing table. For example: I have the field in the report, "Priority." This value comes directly from a table. Based on this, I want a box under priority to automatically populate with the right name. IF Priority equals 1, I want the value of this other field to say "red". If Priority=2 I want it red. If priority=3 I want it yellow and If Priority=4, I want it green. How do I do that???
 
Use an If Statement in the control source of your text box to get the results you want.
Set up a hidden text box called PriorityName with the following:
=IIf([Priority]="2","Red",IIf([Priority]='3',"Yellow","Green"))

Then set up a visible text box and in its control source reference the above, Example: =[PriorityName]

Or as an alternative you can set this up within a new field in the query using on the first IIF Statement and then set your control source to reference this new field in your report.

Good luck.

Good luck
 

Users who are viewing this thread

Back
Top Bottom