GoToPage Method (DoCmd Object)

Applies To

DoCmd Object.

Description

The GoToPage method of the DoCmd object carries out the GoToPage action in Visual Basic. For more information on how the action and its arguments work, see the action topic.

Syntax

DoCmd.GoToPage [pagenumber] [, right, down]

The GoToPage method uses the following arguments.

Argument

Description

pagenumber

A numeric expression that is a valid page number for the active form. If you leave this argument blank, the focus stays on the current page. You can use the right and down arguments to display the part of the page you want to see.

right

A numeric expression that is a valid horizontal offset for the page

down

A numeric expression that is a valid vertical offset for the page


Remarks

The units for the right and down arguments are twips.

If you specify the right and down arguments and leave the pagenumber argument blank, you must include the pagenumber argument’s comma. If you don’t specify the right and down arguments, don’t use a comma following the pagenumber argument.

The GoToPage method of the DoCmd object was added to provide backwards compatibility for running the GoToPage action in Visual Basic code in Microsoft Access for Windows 95. It is recommended that you use the existing GoToPage method of the Form object instead. The GoToPage method of the DoCmd object is different from the GoToPage method of the Form object

See Also

DoCmd Object, GoToControl Method, GoToPage Action, GoToPage Method, GoToRecord Method, SelectObject Method, SetFocus Method.

Example

This example uses the GoToPage method to move the focus to the position specified by the horizontal and vertical offsets on the second page of the active form.


DoCmd.GoToPage 2, 1440, 567