CarbonD1225
CarbonD1225

Reputation: 969

Error while connecting to Access database through Excel 2010

I am trying to retrieve data from an access database on my C drive and i am getting the following error:

"Cannot start your application. The workgroup information file is missing or opened exclusively by another user."

the debugger shows the error in the following piece of code:

MyConnObj.Open _
    "Provider = Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\<database>.mdb;" & _
    "User ID=<username>;" & _
    "Password=<pass>;"

how do i fix this error?

I have the following definitions:

Dim MyConnObj As New ADODB.Connection 'ADODB Connection Object
Dim myRecSet As New ADODB.Recordset 'Recordset Object
Dim sqlStr As String ' String variable to store sql command

Upvotes: 1

Views: 1771

Answers (1)

Steve
Steve

Reputation: 216343

Not sure, but that error means that you need to specify a Workgroup (system database) file. Try to add this to your connection

MyConnObj.Open _ 
    "Provider = Microsoft.Jet.OLEDB.4.0;" & _ 
    "Data Source=C:\<database>.mdb;" & _ 
    "Jet OLEDB:System Database=<path to system.mdw with information on username/pass>;" & _
    "User ID=<username>;" & _ 
    "Password=<pass>;" 

in alternative, if your access mdb is not protected with a system.mdw file, you could try to remove the "User ID" and "Password" parts from the connection string.

Upvotes: 1

Related Questions