Search notes:

Access Object Model: Form

A new form is created with access.createForm ….
A rudimentary VBA piece of code that is supposed to demonstrate how a form can be created is here.
Controls can be added to a form with access.createControl.

Opening and closing forms

A form is opened with doCmd.openForm "frmName" … and closed with doCmd.close acForm…,
doCmd.openForm "frmName", acNormal , , , , acDialog

Form view

An opened form is displayed in one of severelal form views. Each of these form views are listed in the acFormView enumeration:
acDesign 1 Design view
acFormDS 3 Datasheet view
acFormPivotChart 5 PivotChart view
acFormPivotTable 4 PivotTable view
acLayout 6 Layout view
acNormal 0 Form view, this is the default
acPreview 2 Print Preview.
These ac… correspond to the second parameter in doCmd.openForm…

Section

A form consists of a few sections. In order to address a specific section, the section(index) property must be used. index is an enum that lists each section:
acDetail 0
acHeader 1
acFooter 2
acPageHeader 3
acPageFooter 4
For example, the width property of a form can be set with frmObj.width = …, but the height property must be set in the form's detail section: frmObj.section(acDetail).height = ….

Showing/hiding the header and footer section

With VBA, the visibility of the header and footer section can be toggled with
doCmd.runCommand acCmdFormHdrFtr
In the GUI, the corresponding functionality is executed by right clicking the Detail «bar» above the form and then choosing Form Header/Footer:

Controls on a form

The controls on a form are accessible via its controls property.
Because this property is the default property of form, it can be omitted when referring to a control. Both of the following two statements are equivalent:
forms!frmXYZ.controls!tbEntry
forms!frmXYZ!tbEntry

TODO

Type of a form

The type of a form with the name FooBarBaz is Form_FooBarBaz:
debug.print(forms(0).name)
FooBarBaz
debug.Print(typename(forms(0)))
Form_FooBarBaz

See also

AllObjects is the collection that contains all forms, Forms is the collection that only contains open forms.

Index