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.
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?
Reference URL
http://note.phyllo.net/?eid=1106279
http://note.phyllo.net/?eid=1106281
-
Answer # 1
Related articles
- i want to connect to 64-bit ms access from 32-bit python
- mos measures for access2016
- (vba) is there any way to access db with 64-bit excel and 32-bit oracleclient?
- Method for ASPNET oledb to connect to Access database
- PHP uses PDO to connect to ACCESS database
- Two ways to connect to an Access database in Java
- VB6 ADODB code implementation method to connect to Access database
- Several methods for ASPNET to connect to Access database
- i want to connect to access with java and display whether it is connected to the console
- C # programming to connect to the ACCESS database instance
- PHP uses pdo to connect to the access database and display data in a loop
- How to connect and access activemq in java
- 64-bit oracle data access components (odac) differences
- vba - i want to connect to access on onedrive from excel
- access2016 report text box for statement initialization
- i want to connect to sql server with access
- aspnet quick connect access
Trends
The execution module generated by Visual Basic 6.0 is a 32-bit execution module
The library to be used must be 32-bit.