Error in calculation

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
 
T

Tom Lake

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
 
R

Rick B

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top