IIf statement on a report control source

Z

zenonk

I am attempting to create a case on a report, dependant on a check box.
Basically, it will output a prefix to a part number only if the
appropriate checkbox is checked. The first part works, but it fails if
the check box is not checked. Any ideas?

I am trying to replace this:
=IIf(Forms!frm_WorkOrderLkup!Chk_NGCageCode=True,"97942-" &
[PartNumber],[PartNumber])

With something like
=If(Forms!frm_WorkOrderLkup!Chk_NGCageCode=True,"ABCDE-" &
[PartNumber],[PartNumber] Else [PartNumber],[PartNumber])

thanks

Z
 
G

Graham Mandeno

There is no If function, only IIf.

Its form is:
IIf( <condition to test>, <value if true>, <value if false> )

There is no "Then" or "Else", but they are inplied by the second and third
arguments.

The first example you give lokks correct. Why do you want to change it?
 
Z

zenonk

I understand the statement syntax now, thanks.

I wanted to change it because I was geting a "no name" condition
printing (while in design mode). When I ran in user mode (as I should
have done before posting) the problem disappeared. Thanks again, Z.
 

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