COMException unhandled error: invalid file

  • Thread starter Thread starter v_fas
  • Start date Start date
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?
 
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.
 
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.
 
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.
 
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(...
 
Back
Top