I have a question that may seem kinda stupid but I have to admit that I've worked on this for several hours and can't seem to fix it.
I have a list box that includes the physical address of a property. The physical address is made up of several fields so I concatenated the fields to make it easier to view. It looks really good EXCEPT that there are too many spaces between the different field parts - for example:
PhysicalAddress
1421 MIDDLETON RD TANEYVILLE
I have this as the sql statement:
I've tried several different ways to trim it (ltrim(rtrim([field name])) + ' '). I'm not sure what I'm doing wrong? Please help!!!
I have a list box that includes the physical address of a property. The physical address is made up of several fields so I concatenated the fields to make it easier to view. It looks really good EXCEPT that there are too many spaces between the different field parts - for example:
PhysicalAddress
1421 MIDDLETON RD TANEYVILLE
I have this as the sql statement:
Code:
SELECT tblPropertyInfo.PropertyNumber, tblOwners.NameOnDeed, tblPropertyInfo.TaxCode, tblPropertyInfo.DBA, tblPropertyInfo.SubdivisionID,
CASE WHEN [Situs_Address_No] IS NOT NULL THEN [Situs_Address_No] + ' ' ELSE NULL END + CASE WHEN [Situs_Direction_Prefix] IS NOT NULL
THEN [Situs_Direction_Prefix] + ' ' ELSE NULL END + CASE WHEN [Situs_Street_Name] IS NOT NULL THEN [Situs_Street_Name] + ' ' ELSE NULL
END + CASE WHEN [Situs_STreet_Type] IS NOT NULL THEN [Situs_Street_Type] + ' ' ELSE NULL
END + CASE WHEN [Situs_Direction_Suffix] IS NOT NULL THEN [Situs_Direction_Suffix] + ' ' ELSE NULL
END + CASE WHEN [Situs_Bldg_Suite_No] IS NOT NULL THEN [Situs_Bldg_Suite_No] + ' ' ELSE NULL
END + CASE WHEN [Situs_Unit_Lot_No] IS NOT NULL THEN [Situs_Unit_Lot_No] + ' ' ELSE NULL END + CASE WHEN [SitusCity] IS NOT NULL
THEN [SitusCity] ELSE NULL END AS PhysicalAddress
FROM tblPropertyInfo INNER JOIN
tblTaxCode ON tblPropertyInfo.TaxCode = tblTaxCode.TaxCode INNER JOIN
tblOwners ON tblPropertyInfo.CurrentOwnerID = tblOwners.OwnerID
ORDER BY tblPropertyInfo.TaxCode, tblPropertyInfo.PropertyNumber
I've tried several different ways to trim it (ltrim(rtrim([field name])) + ' '). I'm not sure what I'm doing wrong? Please help!!!