DoCmd.GoToRecord

Go to a specific record.

Syntax
      DoCmd.GoToRecord(ObjectType, ObjectName,
                            Record, Offset)

Key
   ObjectType An AcDataObjectType constant that specifies
              the type of database object to search.
              default = acActiveDataObject.

   ObjectName The name of an object of the type selected by
              the objecttype argument.

   Record     An AcRecord constant that specifies the 
              starting point and direction of the search.
              default = acFirst.

   Offset     A numeric expression that represents the number
              of records to move forward or backward if you
              specify acNext or acPrevious for the record argument,
              or the record to move to if you specify acGoTo.
              The expression must result in a valid record number.

The object specified in the ObjectName argument must be open before this action is run. Otherwise, an error occurs.

You can use the GoToRecord method to make a record on a hidden form the current record if you specify the hidden form in the objecttype and objectname arguments.

The SearchForRecord method is similar to the FindRecord method, but SearchForRecord has more powerful search features. SearchForRecord supports logical operators, such as <, >, AND, OR, and BETWEEN. The FindRecord method only matches strings that equal, start with, or contain the string being searched for.

Examples

'Make the 64th record in the form frmEmployees current:
DoCmd.GoToRecord acDataForm, "frmEmployees", acGoTo, 64

“Twenty years from now, you will be more disappointed by the things you didn’t do than by the ones you did do. So throw off the bowlines, sail away from the safe harbour. Catch the trade winds in your sails. Explore. Dream. Discover” ~ Mark Twain

Related

SearchForRecord - Search for a specific record.


 
Copyright © 1999-2024 SS64.com
Some rights reserved