VBA/Excel/Access/Word/Access/Connection String

Материал из VB Эксперт
Перейти к: навигация, поиск

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