Form Object [Access 2003 VBA Language Reference]
Multiple objects Form Multiple objects |
A Form object refers to a particular Microsoft Access form.
Using the Form Object
A Form object is a member of the Forms collection, which is a collection of all currently open forms. Within the Forms collection, individual forms are indexed beginning with zero. You can refer to an individual Form object in the Forms collection either by referring to the form by name, or by referring to its index within the collection. If you want to refer to a specific form in the Forms collection, it's better to refer to the form by name because a form's collection index may change. If the form name includes a space, the name must be surrounded by brackets ([ ]).
Syntax | Example |
---|---|
Forms!formname | Forms!OrderForm |
Forms![form name] | Forms![Order Form] |
Forms("formname") | Forms("OrderForm") |
Forms(index) | Forms(0) |
Each Form object has a Controls collection, which contains all controls on the form. You can refer to a control on a form either by implicitly or explicitly referring to the Controls collection. Your code will be faster if you refer to the Controls collection implicitly. The following examples show two of the ways you might refer to a control named NewData on the form called OrderForm:
' Implicit reference.
Forms!OrderForm!NewData
' Explicit reference.
Forms!OrderForm.Controls!NewData
The next two examples show how you might refer to a control named NewData on a subform ctlSubForm
contained in the form called OrderForm:
Forms!OrderForm.ctlSubForm.Form!Controls.NewData
Forms!OrderForm.ctlSubForm!NewData
Properties | ActiveControl Property | AfterDelConfirm Property | AfterFinalRender Property | AfterInsert Property | AfterLayout Property | AfterRender Property | AfterUpdate Property | AllowAdditions Property | AllowDatasheetView Property | AllowDeletions Property | AllowDesignChanges Property | AllowEdits Property | AllowFilters Property | AllowFormView Property | AllowPivotChartView Property | AllowPivotTableView Property | AutoCenter Property | AutoResize Property | BeforeDelConfirm Property | BeforeInsert Property | BeforeQuery Property | BeforeRender Property | BeforeScreenTip Property | BeforeUpdate Property | Bookmark Property | BorderStyle Property | Caption Property | ChartSpace Property | CloseButton Property | CommandBeforeExecute Property | CommandChecked Property | CommandEnabled Property | CommandExecute Property | ControlBox Property | Controls Property | Count Property | CurrentRecord Property | CurrentSectionLeft Property | CurrentSectionTop Property | CurrentView Property | Cycle Property | DataChange Property | DataEntry Property | DataSetChange Property | DatasheetBackColor Property | DatasheetBorderLineStyle Property | DatasheetCellsEffect Property | DatasheetColumnHeaderUnderlineStyle Property | DatasheetFontHeight Property | DatasheetFontItalic Property | DatasheetFontName Property | DatasheetFontUnderline Property | DatasheetFontWeight Property | DatasheetForeColor Property | DatasheetGridlinesBehavior Property | DatasheetGridlinesColor Property | DefaultControl Property | DefaultView Property | Dirty Property | DividingLines Property | FastLaserPrinting Property | FetchDefaults Property | Filter Property | FilterOn Property | Form Property | FrozenColumns Property | GridX Property | GridY Property | HasModule Property | HelpContextId Property | HelpFile Property | HorizontalDatasheetGridlineStyle Property | Hwnd Property | InputParameters Property | InsideHeight Property | InsideWidth Property | KeyPreview Property | LayoutForPrint Property | MaxRecButton Property | MaxRecords Property | MenuBar Property | MinMaxButtons Property | Modal Property | Module Property | MouseWheel Property | Moveable Property | Name Property | NavigationButtons Property | NewRecord Property | ObjectPalette Property | OnActivate Property | OnApplyFilter Property | OnClick Property | OnClose Property | OnConnect Property | OnCurrent Property | OnDblClick Property | OnDeactivate Property | OnDelete Property | OnDirty Property | OnDisconnect Property | OnError Property | OnFilter Property | OnGotFocus Property | OnInsert Property | OnKeyDown Property | OnKeyPress Property | OnKeyUp Property | OnLoad Property | OnLostFocus Property | OnMenu Property | OnMouseDown Property | OnMouseMove Property | OnMouseUp Property | OnOpen Property | OnResize Property | OnTimer Property | OnUndo Property | OnUnload Property | OpenArgs Property | OrderBy Property | OrderByOn Property | Orientation Property | Page Property | Pages Property | Painting Property | PaintPalette Property | PaletteSource Property | Picture Property | PictureAlignment Property | PictureData Property | PictureSizeMode Property | PictureTiling Property | PictureType Property | PivotTable Property | PivotTableChange Property | PopUp Property | Printer Property | Properties Property | PrtDevMode Property | PrtDevNames Property | PrtMip Property | Query Property | RecordLocks Property | RecordSelectors Property | Recordset Property | RecordsetClone Property | RecordsetType Property | RecordSource Property | RecordSourceQualifier Property | ResyncCommand Property | RowHeight Property | ScrollBars Property | Section Property | SelectionChange Property | SelHeight Property | SelLeft Property | SelTop Property | SelWidth Property | ServerFilter Property | ServerFilterByForm Property | ShortcutMenu Property | ShortcutMenuBar Property | SubdatasheetExpanded Property | SubdatasheetHeight Property | Tag Property | TimerInterval Property | Toolbar Property | UniqueTable Property | UseDefaultPrinter Property | VerticalDatasheetGridlineStyle Property | ViewChange Property | ViewsAllowed Property | Visible Property | WhatsThisButton Property | Width Property | WindowHeight Property | WindowLeft Property | WindowTop Property | WindowWidth Property
Methods | GoToPage Method | Move Method | Recalc Method | Refresh Method | Repaint Method | Requery Method | SetFocus Method | Undo Method
Events | Activate Event | AfterDelConfirm Event | AfterFinalRender Event | AfterInsert Event | AfterLayout Event | AfterRender Event | AfterUpdate Event | ApplyFilter Event | BeforeDelConfirm Event | BeforeInsert Event | BeforeQuery Event | BeforeRender Event | BeforeScreenTip Event | BeforeUpdate Event | Click Event | Close Event | CommandBeforeExecute Event | CommandChecked Event | CommandEnabled Event | CommandExecute Event | Current Event | DataChange Event | DataSetChange Event | DblClick Event | Deactivate Event | Delete Event | Dirty Event | Error Event | Filter Event | GotFocus Event | KeyDown Event | KeyPress Event | KeyUp Event | Load Event | LostFocus Event | MouseDown Event | MouseMove Event | MouseUp Event | MouseWheel Event | OnConnect Event | OnDisconnect Event | Open Event | PivotTableChange Event | Query Event | Resize Event | SelectionChange Event | Timer Event | Undo Event | Unload Event | ViewChange Event
Parent Objects | Control Object | Form Object | Forms Collection | Screen Object | SubForm Object | SubReport Object
Child Objects | Control Object | Controls Object | Form Object | Module Object | Properties Object | Section Object
See Also | Application Object | Control Object | Controls Collection | Forms Collection