Supress dash in zip code

  • Thread starter Thread starter epete367
  • Start date Start date
E

epete367

I have a report where the zip codes are based on a input mask that
includes the hyphen. When I print 5 digit zip codes the hyphen is
visible. I have tried:
=Trim([ShippingCity] & "," & " " & [ShippingState] & " " &
IIF(Len[ShippingPostalCode]>6,[ShippingPostalCode],Left([ShippingPostalCode],5))
My error may be in my parenthesis but I have not been able to see it.
Any help would be appreciated.
 
I have a report where the zip codes are based on a input mask that
includes the hyphen. When I print 5 digit zip codes the hyphen is
visible. I have tried:
=Trim([ShippingCity] & "," & " " & [ShippingState] & " " &
IIF(Len[ShippingPostalCode]>6,[ShippingPostalCode],Left([ShippingPostalCode],5))
My error may be in my parenthesis but I have not been able to see it.
Any help would be appreciated.

You use Len() twice but only the second one had the parenthesis.
You can also combine the comma and the space after the
City (& "," & " " &) into one & ", " &
You need to enclose the =Trim([City] field within it's own set of
parenthesis =Trim([City]) & etc.

Try:
=Trim([ShippingCity]) & ", " & [ShippingState] & " " &
IIF(Len([ShippingPostalCode])>6,[ShippingPostalCode],Left([ShippingPostalCode],5))
 
Since I posted I have changed to using one control for an address block
to suppress blank lines. It now reads:
=([MailingName]+Chr(13)+Chr(10)) & ([CompanyName]+Chr(13)+Chr(10)) &
([ShippingAddress1]+Chr(13)+Chr(10)) &
([ShippingAddress2]+Chr(13)+Chr(10)) & [ShippingCity] & "," & " " &
[ShippingState] & " " & " " &
IIF(Len([ShippingPostalCode])>6,[ShippingPostalCode],Left([ShippingPostalCode],5))

At this point, Preview prompts me to 'Enter Parameter Value'
ShippingPostalCode

If, however, I use:
=([MailingName]+Chr(13)+Chr(10)) & ([CompanyName]+Chr(13)+Chr(10)) &
([ShippingAddress1]+Chr(13)+Chr(10)) &
([ShippingAddress2]+Chr(13)+Chr(10)) & [ShippingCity] & "," & " " &
[ShippingState] & " " & " " & [ShippingPostalCode]

everything looks right except for my hyphen.

Thanks for your assistance. I have managed to confuse myself!
 
Back
Top