Sub ReadField()
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Set conn = CurrentProject.Connection
Set rst = New ADODB.Recordset
rst.Open "Select * from Employees", conn, adOpenStatic
Do While Not rst.EOF
Debug.Print rst.Fields("LastName").Value
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
conn.Close
Set conn = Nothing
End Sub
|