Sub ConnectAndExec()
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Set conn = New ADODB.Connection
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & CurrentProject.Path & _
"\mydb.mdb"
Set rst = conn.Execute("Select * from Employees")
Debug.Print rst.Source
rst.Close
Set rst = Nothing
conn.Close
Set conn = Nothing
End Sub
|