While you must use a Query object to get access to data, you must use the Query object’s resulting rowset to do anything with the data. All navigation methods for getting around in tables depend on the query’s rowset.

The row cursor and navigation

The rowset maintains a row cursor that points to the current row in the rowset. When the Query object is first activated, the row cursor points to the first row in the rowset.

You can get and store the cursor's current position by calling the rowset’s bookmark( ) method.

To move the row cursor, call the rowset’s navigation methods:

next( ) moves the cursor a specified number of rows relative to its current position.

first( ) goes to the first row in the rowset.

last( ) moves to the last row.

goto( ) uses the value returned by bookmark( ) to move back to that specific row.

Because each rowset maintains its own row cursor, you can open multiple queries—each of which has its own rowset—to access the same table and point to different rows simultaneously.

Synchronizing cursor movement in master-detail rowsets

Enabling a linked-detail rowset's navigateMaster and navigateByMaster properties allows master-detail rowsets to be navigated as though they were part of a single, combined rowset (similar to the xDML SET SKIP command).

Note: Using these properties will modify the behavior of the first( ), next( ), last( ), atfirst( ) and atlast( ) methods. For more information, see navigateByMaster.

Rowset modes

Once a Query object has been activated, its rowset is always in one of the following five modes (indicated by the rowset’s state property):

Browse mode, which allows navigation only.

Edit mode, the default, which allows changes to the row.

Append mode, in which the user can type new values for a row, and if the row is saved, a new row is created on disk.

Filter mode, used to implement Filter-By-Form, in which the user types values into the form and dBASE Plus filters out all the rows that do not match.

Locate mode, similar to Filter mode, except that it searches only for the first match, instead of setting a filter.

Rowset events

A rowset has many events used to control and augment its methods. These events fall into two categories:

can- events, so named because they all start with the word can—which are fired before the desired action to see whether an action is allowed to occur; and

on- events, which fire after the action has successfully occurred.

Row buffer

The rowset maintains a buffer for the current row. It contains all the values for all the fields in that row.

You access the buffer by using the rowset’s fields property, which refers to an array of Field objects.