title: ODBC connection failed error in Excel 64-bit
body: <p>I have a linked table in ms-access which is linked to a sql server table, and when I am trying to fetch the data in excel via VBA from ms-access linked table the error message "ODBC connection failed" showing.</p>
  
  <p>Note:- I am manually successfully able to refresh ms-access linked table in ms-access, "peoplemain" is the name of linked table.</p>
  
  <p>Note:- When I tried to fetch data from non linked table, it is running successfully.</p>
  
  <p>Below code is working in Excel-32 bit version, but not working in excel-64 bit.</p>
  
  <p>[code]</p>
  
  <pre><code>Sub FetchData()
  Dim cn As ADODB.Connection
  Dim rs As ADODB.Recordset
  Dim conn As String
  
  conn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\Workflow Tools (Michael Cantor)\Tool For Fixing Bug From Michael Cantor\PI MDT Reconciliation Workflow Tool\SampleforPractice.accdb;"
  
  
  Set cn = New ADODB.Connection
  Set rs = New ADODB.Recordset
  
  cn.Open conn
  
  rs.Open "Select * from peoplemain", cn  'Error Line
  
  
  
  Sheet1.Range("A1").CopyFromRecordset rs
  
  
  rs.Close
  Set rs = Nothing
  cn.Close
  Set cn = Nothing
  End Sub
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Kashif</p>