Can't open new Access DB accdb from my code

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
 
D

Douglas J. Steele

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.
 
G

Guest

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
 
D

Douglas J. Steele

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.
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top