Reputation: 133
OK, so I've read this identical question, but the answers don't work for me:
Connecting VB6 and MS Access 2007
I've removed the reference to Microsoft DAO 3.6 Object Library, and replaced it with a reference to Microsoft Office 12.0 Access database engine Object.
Here's my code:
Dim rcdSetData As ADODB.Recordset
Set rcdSetData = New ADODB.Recordset
rcdSetData.CursorType = adOpenStatic
rcdSetData.ActiveConnection = _
"Provider=Microsoft.Jet.OLEDB.4.0; " _
& "Data Source=" & DBName & "; "
I can open Access 2003 *.mdb files just fine, but when I try to open an Access 2007 *.accdb file, I get:
Error #blahblah, Unrecognized database format 'C:\path\foo.accdb'
foo.accdb is a valid Access 2007 file, as far as Access 2007 cares. No password, BTW, and it isn't open in Access when I run the program.
I'm stumped. EVERY answer I can find on the web says I'm doing this right.... :\
Upvotes: 0
Views: 3736
Reputation: 147
If you have recently re-installed VB6, make sure you download and install the service pack SP6 for it.
Upvotes: 0
Reputation: 4808
The DAO reference (be it to the pre- or post-Access 2007 version of that library) is irrelevant, since your VB code is using ADO instead. Your problem lies rather with the connection string. Try replacing
"Provider=Microsoft.Jet.OLEDB.4.0; " _
with
"Provider=Microsoft.ACE.OLEDB.12.0; " _
Upvotes: 3