IIF statement in Control Source

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm working on a report. The field is Member Type and is text. I've put
=IIf ([Member Type]="Associate","Associate"," ")
in the control source for the text box titled Member Type. I'm getting an
error for each record.

Basically, I only want it to print the member type if it's "Associate". All
others should be left blank.

What am I doing wrong?
 
Change the name of the textbox so that it does not have the same name as the
field. Perhaps txtMemberType.
 
Dumb Blonde,

Ken is correct in the solution to the error problem. I would just add a
further comment... According to your expression, if the Member Type is
not "Associate", you are trying to put in a space. Well, first of all
this won't work because Access will trim the space out anyway. You said
you want it to be "left blank", in which case I would suggest...
=IIf([Member Type]="Associate","Associate",Null)
or...
=IIf([Member Type]="Associate","Associate")
 
thanks for the catch, Steve!
:-)


--

Ken Snell
<MS ACCESS MVP>

Steve Schapel said:
Dumb Blonde,

Ken is correct in the solution to the error problem. I would just add a
further comment... According to your expression, if the Member Type is
not "Associate", you are trying to put in a space. Well, first of all
this won't work because Access will trim the space out anyway. You said
you want it to be "left blank", in which case I would suggest...
=IIf([Member Type]="Associate","Associate",Null)
or...
=IIf([Member Type]="Associate","Associate")

--
Steve Schapel, Microsoft Access MVP

Change the name of the textbox so that it does not have the same name as the
field. Perhaps txtMemberType.
 
Thanks to both of you! I knew it was something easy, I just couldn't figure
out what!

Ken Snell said:
thanks for the catch, Steve!
:-)


--

Ken Snell
<MS ACCESS MVP>

Steve Schapel said:
Dumb Blonde,

Ken is correct in the solution to the error problem. I would just add a
further comment... According to your expression, if the Member Type is
not "Associate", you are trying to put in a space. Well, first of all
this won't work because Access will trim the space out anyway. You said
you want it to be "left blank", in which case I would suggest...
=IIf([Member Type]="Associate","Associate",Null)
or...
=IIf([Member Type]="Associate","Associate")

--
Steve Schapel, Microsoft Access MVP

Change the name of the textbox so that it does not have the same name as the
field. Perhaps txtMemberType.
 

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

Back
Top