title: ms-access VBA long sql query string line split ( with double quote inline) in editor
body: <p>I have a below sql query in MS-Access 2010 wghich works fine in query design window. Now I want to code it through VBA.</p>
  
  <p>ACTUAL QUERY:</p>
  
  <pre><code>INSERT INTO MAINRESULT(EXNAME, MASTER_TICKER,MASTER_CUSIP,TL_TICKER,TL_CUSIP,FC_CUSIP,FC_TICKER)
  SELECT EXC AS MY_EXC,  
  SUM(IIF(MASTER_TICKER &lt;&gt; "NULL", 1, 0)) AS MY_MASTER_TICKER,
  SUM(IIF(MASTER_CUSIP &lt;&gt; "NULL", 1, 0)) AS MY_MASTER_CUSIP,
  SUM(IIF(TL_TICKER &lt;&gt; "NULL", 1, 0)) AS MY_TL_TICKER,
  SUM(IIF(TL_CUSIP &lt;&gt; "NULL", 1, 0)) AS MY_TL_CUSIP,
  SUM(IIF(FC_CUSIP &lt;&gt; "NULL", 1, 0)) AS MY_FC_CUSIP,
  SUM(IIF(FC_TICKER &lt;&gt; "NULL", 1, 0)) AS MY_FC_TICKER
  FROM TESTDATA
  GROUP BY EXC;
  </code></pre>
  
  <p>MY VBA code snippet:</p>
  
  <pre><code>Dim strSQL As String
   Dim db As Database
   Set db = CurrentDb
  strSQL = "INSERT INTO MAINRESULT(EXNAME, MASTER_TICKER,MASTER_CUSIP,TL_TICKER,TL_CUSIP,FC_CUSIP,FC_TICKER) " &amp; _
               "SELECT EXC AS MY_EXC, " &amp; _
               "SUM(IIF(MASTER_TICKER &lt;&gt; "NULL", 1, 0)) AS MY_MASTER_TICKER, " &amp; _
               "SUM(IIF(MASTER_CUSIP &lt;&gt; "NULL", 1, 0)) AS MY_MASTER_CUSIP, " &amp; _
               "SUM(IIF(TL_TICKER &lt;&gt; "NULL", 1, 0)) AS MY_TL_TICKER, " &amp; _
               "SUM(IIF(TL_CUSIP &lt;&gt; "NULL", 1, 0)) AS MY_TL_CUSIP, " &amp; _
               "SUM(IIF(FC_CUSIP &lt;&gt; "NULL", 1, 0)) AS MY_FC_CUSIP, " &amp; _
               "SUM(IIf(FC_TICKER &lt;&gt; "NULL", 1, 0)) As MY_FC_TICKER " &amp; _
               "FROM TESTDATA GROUP BY EXC;"
  
  DoCmd.RunSQL strSQL
  </code></pre>
  
  <p>Unfortunately it is giving error due to that "NULL" thing in editor and always been in red. Is there any more alternate way ? Because those column names will also come dynamically from a select list box so I have to create this strSQL in a parameterized way.</p>