The form or report that contains the component.

Property of

All form components.

Description

A component’s form property is a reference to the form or report that contains it. It is set automatically when the component is created and cannot be changed.

Use the form property in component event handlers and methods to generically refer to the object that contains the component.

In a form, a component’s form and parent property refer to the same thing—the form—if the component is placed directly on the form. However, if for example you place a component in a NoteBook control on a form, then the component’s parent is the NoteBook control, not the form; and the NoteBook control’s parent is the form. In a report, components are contained deeper in the object hierarchy and their parents are never the report.

By using the form property, you can immediately get back to the top of the object hierarchy and refer to its properties, events, or methods; or refer to other objects in the form or report.

In addition to the form property, a local variable named form is also created for any event handler for form, report, or a visual component. The form variable is not created for events in other kinds of classes. The variable and the form property both refer to the same object. The form variable is used in most event handlers.