combining text boxes into one text box

  • Thread starter Thread starter msmuzila
  • Start date Start date
M

msmuzila

Everything works fine until i get a null. here is the code i'm using

=[City] & ", " & [State]

If State is null, i do not want the , to show up. I just want the
City to show and nothing else. How is this done?
 
You can take advantage of a slight difference in the 2 concatenation
operations in Access:
"A" & Null => "A"
"A" + Null => Null

So:
=[City] & ", " + [State]
 
Everything works fine until i get a null. here is the code i'm using

=[City] & ", " & [State]

If State is null, i do not want the , to show up. I just want the
City to show and nothing else. How is this done?


The usual trick is:
=City & (", " + State)

More verbose, but less tricky is:
=City & IIf(IsNull(State), "", ", " & State)
 
Back
Top