title: Insert Linebreak in Ms Access Query
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>So far I have this in my query...</p>
  
  <pre><code>SELECT
  tblCompany.CompanyId,
  tblCompany.CompanyTypeId,
  tblCompany.CompanyName,
      IIF(Len(PafAddress.line1)&gt;0,PafAddress.line1,"") &amp; " "  &amp;
      IIF(Len(PafAddress.line2)&gt;0,PafAddress.line2,"") &amp; " " &amp;
      IIF(Len(PafAddress.line3)&gt;0,PafAddress.line3,"") &amp; " " &amp;
      IIF(Len(PafAddress.line4)&gt;0,PafAddress.line4,"") &amp; " " &amp;
      IIF(Len(PafAddress.Line5)&gt;0,PafAddress.line5,"") &amp; " " &amp;
      IIF(Len(PafAddress.post_town)&gt;0,PafAddress.post_town,"") &amp; " " &amp;
      IIF(Len(PafAddress.county)&gt;0,PafAddress.county,"") &amp; " " &amp;
      IIF(Len(PafAddress.postcode)&gt;0,PafAddress.postcode,"") 
      AS AddressLabel,
  FROM tblCompany
  LEFT OUTER JOIN PafAddress ON tblCompany.PafAddressId = PafAddress.id
  </code></pre>
  
  <p>However this just puts a couple of spaces next to each entry rather than a line break, I have tried </p>
  
  <blockquote>
    <p><code>&amp; CHAR(13)+CHAR(10) &amp;</code></p>
  </blockquote>
  
  <p>But just keep getting </p>
  
  <blockquote>
    <p>UNDEFINED FUNCTION CHAR</p>
  </blockquote>
  
  <p>Can anyone help?</p>