D
Dr. M
Hello! I'm trying to connect to an Access database using Late Binding but my
little simple code will not open the database. I appreciate your help!!!
Sub Test()
Dim strConnection As String
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=M:\database.mdb;"
Dim cn As Object
Set cn = CreateObject("ADODB.Connection")
cn.Open strConnection
' Find out if the attempt to connect worked.
If cn.State = adStateOpen Then
MsgBox "You are connected!"
Else
MsgBox "Sorry. You are not connected."
End If
' cn.Close
End Sub
little simple code will not open the database. I appreciate your help!!!
Sub Test()
Dim strConnection As String
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=M:\database.mdb;"
Dim cn As Object
Set cn = CreateObject("ADODB.Connection")
cn.Open strConnection
' Find out if the attempt to connect worked.
If cn.State = adStateOpen Then
MsgBox "You are connected!"
Else
MsgBox "Sorry. You are not connected."
End If
' cn.Close
End Sub