Hi I am developing a PHP application that unfortunately has to use MS Access as a backend, and I am not 100% up to date with access compared to mysql.
I am trying to produce an address label field in a customer table. The idea being is to have an address line (max of 7), to include line if not null and then line break for next line, so you get a postage label style without blank lines.
So far I have this in my query...
SELECT
tblCompany.CompanyId,
tblCompany.CompanyTypeId,
tblCompany.CompanyName,
IIF(Len(PafAddress.line1)>0,PafAddress.line1,"") & " " &
IIF(Len(PafAddress.line2)>0,PafAddress.line2,"") & " " &
IIF(Len(PafAddress.line3)>0,PafAddress.line3,"") & " " &
IIF(Len(PafAddress.line4)>0,PafAddress.line4,"") & " " &
IIF(Len(PafAddress.Line5)>0,PafAddress.line5,"") & " " &
IIF(Len(PafAddress.post_town)>0,PafAddress.post_town,"") & " " &
IIF(Len(PafAddress.county)>0,PafAddress.county,"") & " " &
IIF(Len(PafAddress.postcode)>0,PafAddress.postcode,"")
AS AddressLabel,
FROM tblCompany
LEFT OUTER JOIN PafAddress ON tblCompany.PafAddressId = PafAddress.id
However this just puts a couple of spaces next to each entry rather than a line break, I have tried
& CHAR(13)+CHAR(10) &
But just keep getting
UNDEFINED FUNCTION CHAR
Can anyone help?