COMException unhandled error: invalid file

V

v_fas

I keep getting an error on the following code:

db = DAODBEngine_definst.OpenDatabase(
"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Temp\MyAccess2007.accdb;Persist Security Info=False;")

I already have installed the Access 12 driver.
Any ideas?
 
S

Stuart McCall

v_fas said:
I keep getting an error on the following code:

db = DAODBEngine_definst.OpenDatabase(
"Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=C:\Temp\MyAccess2007.accdb;Persist Security Info=False;")

I already have installed the Access 12 driver.
Any ideas?

Have you tried Set db, ie:

Set db = DAODBEngine_definst.OpenDatabase...

Also, DAODBEngine_definst needs to be declared (and set up) as a Workspace
object.
 
V

v_fas

How do you set it up as a Workspace object?


Stuart McCall said:
Have you tried Set db, ie:

Set db = DAODBEngine_definst.OpenDatabase...

Also, DAODBEngine_definst needs to be declared (and set up) as a Workspace
object.
 
V

v_fas

Dim wrk As dao.Workspace

Stuart McCall said:
Have you tried Set db, ie:

Set db = DAODBEngine_definst.OpenDatabase...

Also, DAODBEngine_definst needs to be declared (and set up) as a Workspace
object.
 
S

Stuart McCall

v_fas said:
Dim wrk As dao.Workspace

Using wrk instead of DAODBEngine_definst:

Dim wrk As DAO.Workspace
Set wrk = DAO.Workspaces(0)
Set db = wrk.OpenDatabase(...
 

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