Home>

OS: Windows10 Pro 1903 64bit
Access: Office Pro 2016 64bit

We have created a simple program to connect with Visual Basic 6.0.
The following error message occurs at the Open location.
Both DAO and ADO connections are not successful.

Error message
DAO connection
Reference: Microsoft Office15.0 Access database Object Library
errMsg: Class not registered
ADO connection
See: Microsoft ActiveX Data Object 6.1 Library
errMsg: Provider not found. It may not be installed correctly.
Applicable source code
'■ Visual Basic 6.0 DAO connection
Sub Sample ()
    Dim path As String
    Dim db As DAO.Database
On Error GoTo proc_err
    'DB path'
    path = "D: \ Sample.accdb"
    'DB open'
    Set db = OpenDatabase (path)
    'DB connection successful'
    Debug.Print "DB connection successful"
    GoTo proc_end
proc_err:
    Debug.Print Error
proc_end:
    If Not db Is Nothing Then db.Close
    Set db = Nothing
End Sub
'■ Visual Basic 6.0 ADO connection
Sub Sample ()
    Dim path As String
    Dim cs As String
    Dim cn As ADODB.Connection
On Error GoTo proc_err
    'DB path'
    path = "D: \ Sample.accdb"
    'Connection string'
    cs = "provider = Microsoft.ACE.OLEDB.16.0;Data Source ="&path
    'DB connection'
    Set cn = New ADODB.Connection
    cn.ConnectionString = cs
    Call cn.Open
    'DB connection successful'
    Debug.Print "DB connection successful"
    GoTo proc_end
proc_err:
    Debug.Print Error
proc_end:
    'DB disconnect'
    If cn.State<>adStateClosed Then cn.Close
    Set cn = Nothing
End Sub

Confirm that connection can be established by installing "Microsoft Access Database Engine 2010 Redistributable Component 32bit".
→ Can the Visual Basic 6.0 Access connection work without a 32-bit library?

Supplemental information (FW/tool version etc.)

Reference URL
http://note.phyllo.net/?eid=1106279
http://note.phyllo.net/?eid=1106281