IIf works in query but not in report

A

ak49

Does the IIf function work differently in queries from the way it works in
reports?

For example, this works in a query:

lastName: IIf([Last]="Smith",Null,([Last]))

(I can hid the last name "Smith" in the lastName field.)

However, I cannot use the same IIf as a control source in a report. It
generates a circular reference error message.

= IIf([Last]="Smith",Null,([Last]))

(If the name is not "Smith", then print it.)

Is this just how IIf works?
 
M

Marshall Barton

ak49 said:
Does the IIf function work differently in queries from the way it works in
reports?

For example, this works in a query:

lastName: IIf([Last]="Smith",Null,([Last]))

(I can hid the last name "Smith" in the lastName field.)

However, I cannot use the same IIf as a control source in a report. It
generates a circular reference error message.

= IIf([Last]="Smith",Null,([Last]))


Nothing to do with IIf ;-)

The problem is that you accepted the default name, Last, for
the text box. With the name of the text box the same as the
name in the report's record source, the expression goes for
the name of the text box. so it really is a circular
reference. The solution is simply to change the name of the
text box to something else such as txtLast.
 

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