Report Format Creates Error

G

Guest

I set up the following code in the Control Source of a field on a report:

=IIf([Category]="LH" Or [Category]="PH" Or
[Category]="TH",Format([P1],"Fixed"),IIf([Category]="RT",Format([P1],"0.0"),Format([P1],"Percent")))

It worked properly, changing the format for the field depending on the
Category. I put the same code in a similar report and the field shows
#Error. I removed the code and changed it to =Format([P1,"Percent") and it
still showed #Error. I changed it to P1 and it worked. Is there some other
control which must be set to used the Format command on a report field ?
 
M

Marshall Barton

rmcompute said:
I set up the following code in the Control Source of a field on a report:

=IIf([Category]="LH" Or [Category]="PH" Or
[Category]="TH",Format([P1],"Fixed"),IIf([Category]="RT",Format([P1],"0.0"),Format([P1],"Percent")))

It worked properly, changing the format for the field depending on the
Category. I put the same code in a similar report and the field shows
#Error. I removed the code and changed it to =Format([P1,"Percent") and it
still showed #Error. I changed it to P1 and it worked. Is there some other
control which must be set to used the Format command on a report field ?


Make sure the text box is NOT named P1
 
G

Guest

Marsh,

As usual your answer was right on the mark. I changed the name of the field
and it worked. Thank you!


Marshall Barton said:
rmcompute said:
I set up the following code in the Control Source of a field on a report:

=IIf([Category]="LH" Or [Category]="PH" Or
[Category]="TH",Format([P1],"Fixed"),IIf([Category]="RT",Format([P1],"0.0"),Format([P1],"Percent")))

It worked properly, changing the format for the field depending on the
Category. I put the same code in a similar report and the field shows
#Error. I removed the code and changed it to =Format([P1,"Percent") and it
still showed #Error. I changed it to P1 and it worked. Is there some other
control which must be set to used the Format command on a report field ?


Make sure the text box is NOT named P1
 

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