title: Set rst = CurrentDb.OpenRecordset(strSQL) returning an "invalid procedure call"
body: <p>I have an Access database I use to email invoices. It has worked for a couple of years. I am getting an invalid procedure call on <code>Set rst = CurrentDb.OpenRecordset(strSQL)</code>.</p>
  
  <p>It appears that the SQL is correct. I've not made any changes to the database since March of last year.</p>
  
  <pre class="lang-vb prettyprint-override"><code>private Sub Email_AP_Click()
  
  Dim strSQL As String
  Dim rst As DAO.Recordset
  Dim strSubject As String
  Dim strtext As String
  
  
  strSQL = "SELECT DISTINCT Client_Table_AP.EmailAddress, Client_Table_AP.CCEmailAddress, Client_Table_AP.CombineCode, Client_Table_AP.closed, Qry_Client_Table_AP.Client_ID, Qry_Client_Table_AP.Invoice_Total, Qry_Client_Table_AP.CombineName, Qry_Client_Table_AP.FirstName, Qry_Client_Table_AP.TrueMonthText, Qry_Client_Table_AP.TrueYear " &amp; _
          "FROM Client_Table_AP INNER JOIN Qry_Client_Table_AP ON Client_Table_AP.CombineCode = Qry_Client_Table_AP.CombineCode " &amp; _
         "WHERE Len(Client_Table_AP.EmailAddress  &amp; '') &gt;0  and Qry_Client_Table_AP.Invoice_Total &lt;&gt;0"
  
  
  Set rst = CurrentDb.OpenRecordset(strSQL)
  
  While rst.EOF = False
  
      strSubject = "SLIM CD invoice for the Advantage Program: " &amp; rst!CombineName &amp; " for " &amp; rst!TrueMonthText &amp; " " &amp; rst!TrueYear
      strtext = "Dear " &amp; rst!FirstName &amp; "," &amp; Chr(13) &amp; Chr(13) &amp; "Please find your Slim CD statement for " &amp; rst!CombineName &amp; " attached. The amount due will be debited automatically on the 10th of this month." &amp; Chr(13) &amp; Chr(13) &amp; "Let us know if you have any questions." &amp; Chr(13) &amp; Chr(13) &amp; "Thank you," &amp; Chr(13) &amp; Chr(13) &amp; "Ascent Processing Inc." &amp; Chr(13) &amp; "888 721 9301 office" &amp; Chr(13) &amp; "303 827 2467 fax" &amp; Chr(13) &amp; "http://www.ascentprocessing.com"
  
  
      strEMail = rst!EmailAddress
      strccemail = rst!CCEmailAddress
      DoCmd.OpenReport "Rpt_Invoice_AP", acViewPreview, , "[CombineCode]= " &amp; rst!CombineCode, acHidden
      DoCmd.SendObject acReport, "Rpt_Invoice_AP", acFormatPDF, strEMail, strccemail, "slimbilling@ascentprocessing.com", strSubject, strtext, True
      DoCmd.Close acReport, "Rpt_Invoice_AP"
      rst.MoveNext
  Wend
  Set rst = Nothing
  End Sub
  </code></pre>