Mega Code Archive

 
Categories / VisualBasic Script / Access
 

Moving Through the Records in a Recordset

Sub RecordsetMovements()     Dim rst As ADODB.Recordset     Set rst = New ADODB.Recordset     rst.ActiveConnection = CurrentProject.Connection     rst.CursorType = adOpenStatic     rst.Open "Select * from Employees"     Debug.Print rst("EmployeeID")     rst.MoveNext     Debug.Print rst("EmployeeID")     rst.MoveLast     Debug.Print rst("EmployeeID")     rst.MovePrevious     Debug.Print rst("EmployeeID")     rst.MoveFirst     Debug.Print rst("EmployeeID")     rst.Close     Set rst = Nothing End Sub