Export (0) Print
Expand All
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

GO | GOTO Command

Moves the record pointer to the specified record number. There are multiple versions of the syntax.


GO [RECORD] nRecordNumber [IN nWorkArea | IN cTableAlias]

GO TOP | BOTTOM [IN nWorkArea | IN cTableAlias]

GOTO [RECORD] nRecordNumber [IN nWorkArea | IN cTableAlias]

GOTO TOP | BOTTOM [IN nWorkArea | IN cTableAlias]

Parameters

RECORD nRecordNumber

Specifies the physical record number to which you move the record pointer. You can omit GO or GOTO entirely and specify just the record number. If you specify just the record number, you can move the record pointer only within the current work area.

IN nWorkArea

Specifies the work area of the table in which you move the record pointer.

IN cTableAlias

Specifies the alias of the table in which you move the record pointer.

TOP

Positions the record pointer on the first record in the table. If the table has an ascending index in use, the first record is the record with the lowest key value. If the index is in descending order, the first record is the record with the highest key value.

BOTTOM

Positions the record pointer on the last record in the table. If the table has an ascending index in use, the last record is the record with the highest key value. If the index is in descending order, the last record is the record with the lowest key value.

You can use GO and GOTO interchangeably. These commands operate on the table in the current work area unless you specify another work area with the IN clause.

If you use the nRecordNumber argument with GOTO and the specified physical record does not exist in the table, the system will throw a "Record is out of range" error. The record pointer will not move.

NoteNote

GOTO [RECORD] nRecordNumber works with physical records. Thus, it ignores SET DELETED or SET FILTER settings. If the specified physical record number exists in the table, the system moves the pointer to the record. This occurs even if that record has been marked for deletion or may be marked for exclusion by any filter in effect on the table. However, GOTO TOP/BOTTOM works with logical record positions. Therefore, you must respect the SET DELETED, SET FILTER and SET ORDER settings.

CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'data\testdata')
USE products  && Opens Products table
USE customer IN 0  && Opens Customer table
GO BOTTOM IN products
CLEAR
? RECNO('products')
GO TOP
? RECNO( )     && Displays 1
GO 5
? RECNO( )     && Displays 5
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.