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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining Address fields 1

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
0
0
US
Ever find yourself in one of those situations where you ask do you really want to do that ? are you sure ? ok then dont blame me.

I have a table with 8 fields, first one is CustID, the next seven fields are called Address Line 1, Address Line 2, etc etc

what I need to do Is combine all those fields into one, but not all the fields are populated , some records are fully complete others ahve bits and pieces missing from other fields

now they want each Line seperated by a comma,
without writing a million and one If statements anyone know a better way of doing this ?


 
Each line? or each field??

I assume this is going to be for a Mail Merge of some sort. If you do it in word, word will automatically suppress the blanks so you don't have to do anything, just give them it all with the blanks and word will do the rest. Joe Miller
joe.miller@flotech.net
 
How about this

Concatenate them all together using '&' and vbNewline and use the nz funtion to avoid the problem of concatenating NULL values



strFullAddress = Nz([CustID],"") & Nz([AddressLine1] & "," & vbNewLine,"") & Nz([AddressLine2] & "," & vbNewline,"") etc
 
OOPS I missed a "," out of the first Nz but I think you get the idea
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top