Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VV annoying - Removing blank lines in a custom form text box

Status
Not open for further replies.

limitup77

IS-IT--Management
Jun 9, 2003
41
GB
Thanks to anyone who can help with this, I have address fields that I want to place on seperate lines, removing any blank fields.

I have the following code to do so:

=IIf(IsNull([Organisation]),"",[Organisation] & ", ") & IIf(IsNull([House Number/Name]),"",[House Number/Name] & IIf(IsNull([Property]),"",[Property] & ", ") & " " & IIf(IsNull([Street]),"",[Street] & ", ") & IIf(IsNull([Locality]),"",[Locality] & ", ") & IIf(IsNull([Town]),"",[Town] & ", ") & IIf(IsNull([County]),"",[County] & ", ") & IIf(IsNull([Postcode]),"",[Postcode]))

But this just places then all next to each other e.g.

11 Madeup Lane, London, SW6

I have tried the expressions from various sources which suggest placing an underscore (_) after the &, but this just gets me an error message.

How do I get them all to sit on different lines without having blank ones?

Thanks
 
You may try to play with & Chr(13) & Chr(10) instead of & ", "

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Many thanks PHV, that works perfectly!

For anyone referencing this, the full code is:

=IIf(IsNull([Organisation]),"",[Organisation] & ", " & Chr(13) & Chr(10)) & IIf(IsNull([House Number/Name]),"",[House Number/Name] & " " & IIf(IsNull([Street]),"",[Street] & ", " & Chr(13) & Chr(10)) & IIf(IsNull([Property]),"",[Property] & "," & Chr(13) & Chr(10)) & IIf(IsNull([Locality]),"",[Locality] & "," & Chr(13) & Chr(10)) & IIf(IsNull([Town]),"",[Town] & ", " & Chr(13) & Chr(10)) & IIf(IsNull([County]),"",[County] & ", " & Chr(13) & Chr(10)) & IIf(IsNull([Postcode]),"",[Postcode]))

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top