Error in calculation

  • Thread starter Thread starter mogens
  • Start date Start date
M

mogens

I have tried all afternoon to get this expression to work in a control
source in a report field:
=IIf([carrier]="RM";"Royal Mail Airmail";"Courier Service")

I dragged the Field "Carrier" into the report, and then chose
Properties, Data > Control Source, where I entered the above formula.
But it returns #Error ?!?!

I simply don't understand what I do wrong, as the field "carrier"
displays fine the two values "RM" and "EC" that currently exist in the
database if I do a simple insert of the field and view the report.

Mogens
 
I have tried all afternoon to get this expression to work in a control source in a
report field:
=IIf([carrier]="RM";"Royal Mail Airmail";"Courier Service")

I dragged the Field "Carrier" into the report, and then chose Properties, Data >
Control Source, where I entered the above formula. But it returns #Error ?!?!

I simply don't understand what I do wrong, as the field "carrier" displays fine the
two values "RM" and "EC" that currently exist in the database if I do a simple
insert of the field and view the report.

Change the name of the control to something other than Carrier when using
the Carrier field in an IIf statement (or any calculated source)

Tom Lake
 
The statement you list above should be placed in an unbound text box, not in
the control source for a field you added to the database.

In order to work, you'll also need the actual field pulled to the report so
that your text box can see what the value of [carrier] is. You could always
make it invisible.

A better way might be to do this in your report's query. then you have a
new named field you could pull to your report. To do so:

Add a new column to your query. Put the following in the place where you'd
normally put the field name:

FormCarrier: IIf([carrier]="RM";"Royal Mail Airmail";"Courier Service")

Then your report field picker would have a new selection of "FormCarrier"
that you can drag to your report.
 
Back
Top