Supress dash in zip code

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.
 
F

fredg

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))
 
E

epete367

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top