Senin, 19 Februari 2024

Re: [MSAccessProfessionals] ADODB.Connection not opening DB

For clarity, are you expecting that the target database will actually visibly open for the user?  An ADO connection is a behind the scenes connection for opening a recordset or executing a procedure.  You wouldn't see anything happen with your code as is.  If you want to open the database for the user try FollowHyperlink.

Paul

------ Original Message ------
Sent: 2/18/2024 5:25:07 PM
Subject: [MSAccessProfessionals] ADODB.Connection not opening DB

I'm pulling my hair out - why isn't this code opening the DB the references are correct - so it the filename and location.  The code runs with no errors but the DB is not opened.  It's 2007 Access and I'd like to say with ADO because of other reasons.

Any help would be appreciated - AI was not help :)

Private Sub Number3_Click()
 
    On Error GoTo OOPS
        
    Dim TestConn As ADODB.Connection
 
    Set TestConn = New ADODB.Connection
    TestConn.Provider = "Microsoft.Jet.OLEDB.4.0"
        
        TestConn.Open "C:\Junk\Tester1.MDB"
 
OOPS:
    MsgBox ("Sorry, Test3 not working")
 
End Sub
 

Tidak ada komentar:

Posting Komentar