Visual Basic Concepts

Navigating Recordsets

See Also

Once you have bound controls on a Visual Basic form to a DataEnvironment object, you can add navigation buttons that allow the user to move through data at run time.

To add navigation buttons to your Visual Basic form

  1. Drop two Command buttons on your form. You will use these to navigate through your Data Environment's Recordset object.

  2. Right-click your Visual Basic form and select View Code from the shortcut menu.

  3. For the Previous button, add the following code to the Click event.
    DECustomers.rsCustomers.MovePrevious
    
  4. For the Next button, add the following code to the Click event.
    DECustomers.rsCustomers.MoveNext
    
  5. Click Run on the Visual Basic toolbar to run your form, and click the Previous and Next buttons to navigate between records.

    Note   You can use any ADO method in this procedure, such as MoveFirst or MoveNext. To add update and delete capabilities to your form, use the Update and Delete methods.