'Microsoft ActiveX Data Objects Recordset 2.7 Library
Sub ConnectionExample1()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
With conn
.Provider = "Microsoft.Jet.OLEDB.4.0;"
.ConnectionString = "Data Source=" & _
CurrentProject.Path & "\mydb.mdb"
End With
conn.Open
MsgBox "Connection was opened"
conn.Close
Set conn = Nothing
MsgBox "Connection was closed"
End Sub
|