Retrieving Field Values
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
1. | Get rows from Recordset | ||
2. | Use '!' to reference column in a recordset | ||
3. | Accessing Data with the Fields Collection and Field Objects |