Sub ConnectToDatabase()
Dim Connection As ADODB.Connection
On Error GoTo Except
Set Connection = New ADODB.Connection
Connection.Provider = "Microsoft.Jet.OLEDB.4.0"
Connection.ConnectionString = "data source=C:\nwind.mdb"
Connection.Mode = adModeReadWrite
Connection.Open
MsgBox "Connected via " & Connection.Provider & " OLE DB Provider!", vbInformation
Exit Sub
Except:
MsgBox Err.Description, vbCritical
End Sub