Cycle Property

Applies To

Frame control, Page object, UserForm object.

Description

Specifies the action to take when the user leaves the last control on a Frame or Page.

Syntax

object.Cycle [= fmCycle]

The Cycle property syntax has these parts:

Part

Description

object

Required. A valid object.

fmCycle

Optional. Specifies whether cycling includes controls nested in a Frame or MultiPage.


Settings

The settings for fmCycle are:

Constant

Value

Description

fmCycleAllForms

0

Cycles through the controls on the form and the controls of the Frame and MultiPage controls that are currently displayed on the form.

fmCycleCurrentForm

2

Cycles through the controls on the form, Frame, or MultiPage. The focus stays within the form, Frame, or MultiPage until the focus is explicitly set to a control outside the form, Frame, or MultiPage.


If you specify a non-integer value for Cycle, the value is rounded up to the nearest integer.

Remarks

The tab order identifies the order in which controls receive the focus as the user tabs through a form or subform. The Cycle property determines the action to take when a user tabs from the last control in the tab order.

The fmCycleAllForms setting transfers the focus to the first control of the next Frame or MultiPage on the form when the user tabs from the last control in the tab order.

The fmCycleCurrentForm setting transfers the focus to the first control of the same form, Frame, or MultiPage when the user tabs from the last control in the tab order.

Example

The following example defines the Cycle property for a Frame and two Page objects in a MultiPage.

To use this example, copy this sample code to the Declarations portion of a form. Make sure that the form contains:

  • A Frame named Frame1.
  • A MultiPage named MultiPage1 that contains two objects named Page1 and Page2.
  • Two CommandButton controls named CommandButton1 and CommandButton2.
In the form, the Frame, and each Page of the MultiPage, place a couple of controls, so you can see how Cycle affects the tab order of the Frame and MultiPage.

The user should tab through the controls to observe how Cycle affects the tab order. Pressing CommandButton1 extends the tab order to include controls in the Frame and Page objects. Pressing CommandButton2 restricts the tab order.

Private Sub RestrictCycles()
'Limit tab order for the Frame and Page objects
    Frame1.Cycle = fmCycleCurrentForm
    MultiPage1.Page1.Cycle = fmCycleCurrentForm
    MultiPage1.Page2.Cycle = fmCycleCurrentForm
End Sub

Private Sub UserForm_Initialize()
    RestrictCycles
End Sub

Private Sub CommandButton1_Click()
'Extend tab order subforms (the Frame and Page objects)
    Frame1.Cycle = fmCycleAllForms
    MultiPage1.Page1.Cycle = fmCycleAllForms
    MultiPage1.Page2.Cycle = fmCycleAllForms
End Sub

Private Sub CommandButton2_Click()
    RestrictCycles
End Sub