IIf function in Microsoft Access 2000

L

Leslie

Good morning. I am trying to include the Iif function in
a report text box as follows:

=IIf([SEX]="F","Female","Male")

When I do this, I get an #Error message on the report
rather than Female or Male.

For some reason, since I have been using Access 2000, this
happens frequently when I try to use Iif. I used this
function routinely in Access 97 without any issues.

What am I doing wrong?

Thanks!, Leslie
 
M

Marshall Barton

Leslie said:
Good morning. I am trying to include the Iif function in
a report text box as follows:

=IIf([SEX]="F","Female","Male")

When I do this, I get an #Error message on the report
rather than Female or Male.

For some reason, since I have been using Access 2000, this
happens frequently when I try to use Iif. I used this
function routinely in Access 97 without any issues.


Check the name of the text box, I'll bet it's named SEX. If
so, when you changed the text box's control source from a
bound field to an expression, you created a circular
reference (the expression refers to itself). Just change
the name of the text box to something else such as txtSex.
 
D

Duane Hookom

Make sure the name of the text box is not "SEX" (or the name of any other
field).
Using a name like "txtSex" would be like practicing safe sex...;-)
 
G

Guest

Check to make sure the table that SEX is on is populated
with data.....in that field, or make sure table is not
empty or it will give you an #Error on the report.
 
Top