title: Access 2007: type mismatch when opening an ADO connection
body: <p>I have an Access ADP file. I upgraded the back-end database to point to a SQL 2005 server instead of a SQL 2000 server and changed the database connection information appropriately.  The file runs perfectly fine on my own system, running Windows 7 (64-bit) and Access 2007.  On the target systems running Windows XP and Access 2007, the primary functionality of the database blows up almost immediately with a "Run-time error '13': Type Mismatch" error.</p>
  
  <p>At first I thought I was suffering from the same problem as described <a href="https://stackoverflow.com/questions/6034959/open-recordset-in-access-2003-2007">in this question over here</a>, where the default definition of a connection is DAO but the database is using an ADO object.  However, in reviewing the code, every instance of a connection is specifically declared as "ADODB.Connection".</p>
  
  <p>The code in question that causes the error is this:</p>
  
  <pre><code>Public Sub Tools()
  dim db as ADODB.Connection
  dim sql as String
  
  sql = "Select SSPatch from tblPlastech"
  set db = CurrentProject.Connection           ' THIS LINE CAUSES THE TYPE MISMATCH ERROR
  dim rst as ADODB.RecordSet
  set rst = New ADODB.RecordSet
  
  rst.open sql, db, adOpenKeyset, adLockOptimistic
  gsSSpath = rst!sspath
  QUOTES = Chr(34)
  rst.Close
  set rst = Nothing
  db.Close
  set db = Nothing
  
  End Sub
  </code></pre>
  
  <p>Can anyone shed a bit of light on the issue?  Right now I'm stumped.</p>