Sub CreateConnection()
'Declare and instantiate the connection
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
'Open the connection
cnn.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Persist Security Info=False;" & _
"User ID=Admin;" & _
"Data Source=" & CurrentProject.Path & _
"\YourDb.accdb;"
cnn.Close
Set cnn = Nothing
End Sub
|