title: Pulling Information from Access into Excel
body: <p>So currently I have code to pull a whole entire table worth of information from Access into Excel using Excel VBA. Is there a way that I can run a query in Excel VBA for Access and then just Pull they Query Data Across? </p>
  
  <p>My Code for Pulling across as of now:</p>
  
  <pre><code>    Sheets(q).Select
      tablename = Sheets(q).Name
      Set cnt = New ADODB.Connection
      dbPath = "\FIMS_CDFT_Database.mdb"
      sPath = ActiveWorkbook.Path
      dbConnectStr = "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _
      "Data Source=" &amp; sPath &amp; dbPath &amp; ";"
      With cnt
          .Provider = "Microsoft.Jet.OLEDB.4.0"
          .Open dbConnectStr
      End With
      sCmndString = "SELECT * FROM " &amp; tablename
      Set rs = CreateObject("ADODB.Recordset")
      rs.Open sCmndString, cnt, 2, 3, 1
  
       'transfer data to Excel
      Range("A4").CopyFromRecordset rs
  </code></pre>