Access 2007: Type Mismatch When Opening an ADO Connection

I have an access .adp file. I updated the base database by pointing to the SQL 2005 server instead of the SQL 2000 server and changing the database connection information accordingly. The file works fine on my own system, running Windows 7 (64-bit) and Access 2007. On target systems running Windows XP and Access 2007, the main database functions explode almost immediately with a "Runtime Error" Error "13 : Type mismatch error. "

At first it seemed to me that I was suffering from the same problem that I described in this question here , where the standard definition of a connection is DAO, but the database uses an ADO object. However, when viewing the code, each instance of the connection is definitely declared as "ADODB.Connection".

This code throws an error:

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

Can anyone shed some light on the problem? I'm at a dead end right now.

+5
source share
5 answers

Here is what I finally figured out that it matters:

64- Windows 7 Pro Microsoft MDAC , MDAC "UNKNOWN" 6.1.7600.16385 6.1.7601.17514 ( Windows). 32- Windows XP, , Component Checker , "MDAC 2.8 SP1 ON WINDOWS XP SP3" 2.81.1132.0 2.81.3012.0, MDAC.

"" , XP, , , , , ( 13, , 430) ( , XP Windows 7). Windows 7 XP, , , .

: -, Windows Vista/7 "WDAC" "MDAC", , Win7 SP1, , , support.microsoft.com kb article 2517589 . , " " ADO.

2: , , , ( ) Win7SP1, WinXP .

+6

ADO Connection SQL Server. ConnectionString . , CurrentProject.Connection. , , - . ADO- , VB ++ ADO.

+1

MicOSoft ActiveX Data Objects, ? "ADODB." , ADODB, ?

, db ADODB.connection currentProject.connection ! , ?

typeOf\typeName currentProject.connection. :

? typeOf currentproject.Connection is ADODB.Connection
True

? typeName(currentproject.Connection)
Connection

, ....

0

:

rst.open sql, db, adopenkeyset, adlockoptimistic

:

rst.open sql, currentproject.connection, adopenkeyset,adlockoptimistic?

0
source

In the VBA editor, go to "Settings-Tools" and turn off "MS ActiveX Data Objects 2.8 Library", then turn on "MS DataX Data Objects 2.8 Library". At least I worked.

0
source

All Articles