Use parameter name connection string : Connection String « Access « VBA / Excel / Access / Word






Use parameter name connection string

 
Sub ConnectionExample2()
   Dim conn As ADODB.Connection

   Set conn = New ADODB.Connection
   conn.Open "Provider = Microsoft.Jet.OLEDB.4.0;" & _
       "Data Source=" & CurrentProject.Path & _
       "\mydb.mdb"
   MsgBox "Connection was opened"
   conn.Close
   Set conn = Nothing
   MsgBox "Connection was closed"
End Sub

 








Related examples in the same category