Minggu, 18 Februari 2024

Re: [MSAccessProfessionals] ADODB.Connection not opening DB

> "Microsoft.Jet.OLEDB.4.0"
That's most likely your reason.
That is the JET database engine (a.k.a. Access 2003). Even if those drivers are present on your system (which is no longer any guarantee), they may be likely to fail for several possible reasons.
 
1) the database should be converted to a .accdb (which is Access 2007+ format*)
2) the driver connection string you need for Access 2007-format instead is: "Provider = Microsoft.ACE.OLEDB.12.0; Data Source = C:\myFolder\myAccessFile.accdb" IF the 2007 version of the database engine is installed in your system (they may be a newer version that may lead to other versioning troubles when database maintenance is needed).
 
The ACE database engine drivers can successfully open .mdb-format database files**, but the converse is NOT true.
 
*providing that the .mdb->.accdb file conversion was not done with a more recent version of Access than 2007 with features enabled that can cause backwards-compatibility issues with earlier post-2003 versions due to the use of incompatible newer features like, 64-bit integers, graphic-storage formats, attachment columns, advanced encryption and the like (options which may be enabled by default in newer Office versions)
 
** unless they are workgroup-protected .mdb database files, support for which is limited and requires some more advanced configuration hoops to be jumped through (which is not impossible, merely more difficult)
 
However, all this begs a better question: why the heck don't you want to move the database you intend to continue using and supporting forwards from software that is now, in all seriousness, more than 20 years out of date? You seriously DO need to bite the bullet and modernize this database because keeping in in the older formats WILL cause you more trouble going forward. I can virtually guarantee it.
 
.
On 02/18/2024 8:25 PM EST rickhubner@gmail.com wrote:
 
 
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