title: Running an Access Query from Excel
body: <p>I am attempting to run a query in access from excel, and then have those results pulled into the excel document using ADO in VBA. Unfortunately, I cannot figure out how to run the access query such that data in the active cell of the excel sheet is used as a criteria in the access query. </p>
  
  <p>I am running Excel and Access 2007. I've included what code I have so far below. Thanks in advance for your help. </p>
  
  <pre><code>Sub testdb()
  
  Dim con As ADODB.Connection
  Dim rs As ADODB.Recordset
  Set con = New ADODB.Connection
  With con
  .Provider = "Microsoft.ACE.OLEDB.12.0"
  .Open "H:\WBC\Lukas\STOP.accdb"
  End With
  con.Execute "HPRSearch"
     'the criteria field is 'Input', and I need to pull it from the active cell on the Excel Sheet
  End Sub
  </code></pre>