The following code works fine with no errors. However, if I replace
"Microsoft.Jet.OLEDB.3.51" with "Microsoft.Jet.OLEDB.4.0", then the line of
code adoRecordset.Open "select * from current", adoConnection produces the
error message: "Method open of '_Recordset' failed.
What is different about Jet 4.0? Jet 4.0 is one of the choices when I set
up a connection in the VB 6 Data Environment, so it must be installed.
Dim adoConnection As ADODB.Connection
Dim adoRecordset As ADODB.Recordset
Dim Connectionstring As String
Set adoConnection = New ADODB.Connection
Set adoRecordset = New ADODB.Recordset
Connectionstring = "Provider=Microsoft.Jet.OLEDB.3.51; Persist Security
Info=False; Data source = " & App.Path & "\" & "label_database.mdb"
adoConnection.Open Connectionstring
If adoConnection.State = adStateOpen Then
MsgBox ("the connection is open")
Else
MsgBox ("the connection is not open")
End If
adoRecordset.Open "select * from current", adoConnection