Tex Box

  • Thread starter Thread starter Jaime
  • Start date Start date
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
 
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.
 
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"
 
Back
Top