Strings not appearing

  • Thread starter Thread starter Evan McCutchen
  • Start date Start date
E

Evan McCutchen

Hello,

I am combining three fields in a query (City, state, and Zip) and then
having them print on a newsletter. If one of the fields doesn't contain a
value (like zip, for example), the whole CityStateZip string is blank. How
can i avoid this? I would like for the string to print, leaving out the
blank value.

Thanks,
Evan McCutchen
 
How are you combining it? It should work the way you say that you'd like
for it to.

FULLADDRESS: [CITY] & ", " & [STATE] & " " & [ZIP]


Rick B



Hello,

I am combining three fields in a query (City, state, and Zip) and then
having them print on a newsletter. If one of the fields doesn't contain a
value (like zip, for example), the whole CityStateZip string is blank. How
can i avoid this? I would like for the string to print, leaving out the
blank value.

Thanks,
Evan McCutchen
 
The arithmetic operators propagate Nulls; the concatenation operator
("&") doesn't. With numerics, this always makes sense. With Strings,
you sometimes want the result of using "+" instead of "&".

e.g. to get full name from FirstName, LastName, and MiddleInitial,
when the latter may be absent:

FirstName & " " & MiddleInitial + ". " & LastName

If MiddleInitial is Null, you don't get the (then) unwanted period and
space.

Ah, i was using + instead of &.

Thanks for the correction!
Evan M

Rick B said:
How are you combining it? It should work the way you say that you'd like
for it to.

FULLADDRESS: [CITY] & ", " & [STATE] & " " & [ZIP]


Rick B



Hello,

I am combining three fields in a query (City, state, and Zip) and then
having them print on a newsletter. If one of the fields doesn't contain a
value (like zip, for example), the whole CityStateZip string is blank. How
can i avoid this? I would like for the string to print, leaving out the
blank value.

Thanks,
Evan McCutchen


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
ooh, that makes sense! thanks Peter!
Evan M.
evan AT radiologyonesource DOT com

Peter R. Fletcher said:
The arithmetic operators propagate Nulls; the concatenation operator
("&") doesn't. With numerics, this always makes sense. With Strings,
you sometimes want the result of using "+" instead of "&".

e.g. to get full name from FirstName, LastName, and MiddleInitial,
when the latter may be absent:

FirstName & " " & MiddleInitial + ". " & LastName

If MiddleInitial is Null, you don't get the (then) unwanted period and
space.

Ah, i was using + instead of &.

Thanks for the correction!
Evan M

Rick B said:
How are you combining it? It should work the way you say that you'd like
for it to.

FULLADDRESS: [CITY] & ", " & [STATE] & " " & [ZIP]


Rick B



Hello,

I am combining three fields in a query (City, state, and Zip) and then
having them print on a newsletter. If one of the fields doesn't contain a
value (like zip, for example), the whole CityStateZip string is blank. How
can i avoid this? I would like for the string to print, leaving out the
blank value.

Thanks,
Evan McCutchen


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Back
Top