fields blank

R

rml

I'm using the following code to combine four fields. It works fine. My
problem is when all the fields are blank I get #Error on the report for that
record. What I would like when all fields are blank is "NA" to be placed.

Thanks.

=Left(IIf(IsNull([np1]),"",[np1] & ", ") & IIf(IsNull([np2]),"",[np2] & ",
") & IIf(IsNull([np3]),"",[np3] & ", ") & IIf(IsNull([np4]),"",[np4] & ",
"),Len(IIf(IsNull([np1]),"",[np1] & ", ") & IIf(IsNull([np2]),"",[np2] & ",
") & IIf(IsNull([np3]),"",[np3] & ", ") & IIf(IsNull([np4]),"",[np4] & ",
"))-2)
 
E

Evi

You might be better off using

([np 2] + ", ") & ([np 2] + ", ") & etc

If you use a + sign in brackets, and a field within the brackets is Null,
then all the stuff within the brackets becomes null

Then you can use =NZ(([np 2] + ", ") & ([np 2] + ", ") & ([np 2] + ", "),
NA)
Evi
 

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

Similar Threads

combine fields 12
Driver Problem 1
Address box with IIf Statement 7
Report gone bad... 3
Microsoft VBA and Printing to templates using code 1
IIF statement question 3
Iff in address block 1
Blank Lines in Report 1

Top