Can't open new Access DB accdb from my code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I've upgraded my Access DB to 2007 (accdb format) and now my code in Excel
is saying that the database is an unrecognized format.

I'm using DAO 3.6 (in Excel) to allow Excel to control Access. I tried
loading Access 12 objects and putting that at the top in the references and
it didn't work. If I remove the reference to DAO 3.6 my code won't compile.

Heres a couple of lines of code:

Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase(DBPath & DBFileName)

I'm using objects like database, recordset, movefirst. Do I need to prefix
the lines with something?

Can anyone guide me as to how to fix this problem?

Any help will be greatly appreciated

Thanks
Suzanne
 
Since the file format changed significantly, DAO 3.6 is not able to open a
accdb.

To what specifically did you set a reference when you say that "loading
Access 12 object...didn't work"? The exact file to be referenced is
acedao.dll (by default, it should be in c:\Program Files\Microsoft
Office\Office12\). Afraid I don't have Access 2007 installed on this
machine, so I can't tell you how it appears in the list of references.
 
Hi Douglas,

Thanks for the reply. I was using Ms Access 12.0 Object Library, which is a
file called MSACC.OLB not the one you specify. So I got that wrong.

There are so many reference headings I can only find the correct one by
browsing to the file (acedao.dll) however when I select it nothing extra
seemed to be ticked in my available refrences.

How do I add that one in?

Thanks for your help

s
 
If you browse to it and select it, I would expect it to show up under the
References. It may well still be identified as DAO once selected.
 
Hi Doug,

I think I found the one I should select:

MS Office 12.0 Access Database Engine Object Library

Its hard to see the file it connects to in the dialog box because the path
to the file is so long it doesn't show up.

Thanks again

S
 
Back
Top