Tex Box

J

Jaime

I am coming several fields with one text box.
Someone replied and told me how to put parenthesis around
the fields.

I also want to know how to prevent them from showing if
the fields are blank.. and also to hide the commas between
the fields if there is no value in the field for that
record?


Thanks
 
R

Randy Armstrong

Try an if statement:

if the fields allow nul values

=iif(isnull([Field1]),"",[Field1]&", ") & iif(isnull
([Field2]),"",[Field2]&", ") & iif(isnull([Field3]),"",
[Field3])

or if they don't allow nulls

=iif([Field1]="","",[Field1]&", ") & iif([Field2]="","",
[Field2]&", ") & iif([Field3]="","",[Field3])


There's still an issue with the extra commas if the last
field(s) in the concatenation is(are) empty.
 
D

Duane Hookom

You can concatenate fields together using a combination of "+" and "&". The
plus sign will Null its adjacent value. For instance
"Eau Claire" + ", " + "WI" = "Eau Claire, WI"
Null + ", " + "WI" = Null
"Eau Claire" & ", " + Null = "Eau Claire"
 

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