ADO Connection Error

aaronward

Board Regular
Joined
Aug 2, 2006
Messages
165
I am attempting to simply connect to an external Access database and display some basic information. however my password for the connection does not seem to be working. Code breaks right at my 'conn.Open CNCT' line and suggests the following:
'Cannot start your application. The workgroup information file is missing or opened exclusively by another user'
I have triple checked that the database is not opened and i have no other connections to it.
any suggestions? Thanks!

Code:
Private Sub ReadIn()
    Dim rst As ADODB.Recordset
    Dim conn As ADODB.Connection
    Dim dbFullName As String, SRC As String, CNCT As String
    Dim strSql As String, MArray
    
    'db information
    dbFullName = ThisWorkbook.Path & "\backend.mdb"
    
    'open connection
    Set conn = New ADODB.Connection
    CNCT = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
        dbFullName & "; User ID=admin; Password=test;"
    conn.Open CNCT
    
    strSql = "SELECT * FROM tblCPR"
    rst.Open strSql, conn, adOpenKeyset, adLockOptimistic
    
    MArray = rst.GetRows
    MsgBox UBound(MArray(1)) & vbCr & UBound(MArray(2))
    
    'clean up
    Set rst = Nothing
    conn.Close
    Set conn = Nothing
    
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I was able to research this thru another forum. Just in case someone else searches and has the same issue -

My connection string was incorrect. It should have been:

CNCT = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbFullName & _
";Jet OLEDB:Database Password=" & DB_Password & ";"
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,020
Members
448,938
Latest member
Aaliya13

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top