Full Version: Problem with concatenated text box
UtterAccess Discussion Forums > Microsoft® Access > Access Reports
littlethief
I have a report that concatenates the City, State and Zip Code fields:
CODE
=[Provider_City] & ", " & [Provider_State] & " " & [Provider_Zip]


All of a sudden, if a zip code has a hypen, instead of coming out as 45429-1298, it will come out as 454291298.

Nothing has changed but we can't figure out why it's happening. Can anyone help with this?

Thanks!
dberninger
I'd like to help but there is a question first.

The provider_zip is usually stored as two seperate fields, the first five and the optional last 4. Are you doing a concatenation on these fields to create the one number with the hyphen?
littlethief
No, it's stored in one field with an input mask.
rbianco
Are you applying the Zip Code Input mask at the design level of the table where you are storing the zip code information? If so, this puts your zip plus 4 into one field and your above result is "normal" when concatenating it all into one string.

One fix is to do this at point of concatenating:
=[Provider_City] & ", " & [Provider_State] & " " &IIf(Len([Provider_Zip])<9,Left([Provider_Zip],5),Left([Provider_Zip],5) & "-" & Right([Provider_Zip],4))
littlethief
That worked. Thank you so much!!!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.