E.14. The Forms Collection

The Forms collection contains all of the forms associated with the current database.

E.14.1. Properties of the Form Object

The Form object contains a variety of properties, methods, and events that are listed in the following tables.

PropertyData TypeDescription
ActiveControlControl objectUsed with the Screen object to determine the control that has the focus
AfterDelConfirmStringIndicates which macro, event procedure, or user-defined function runs when the AfterDelConfirm event occurs
AfterFinalRenderStringIndicates which macro, event procedure, or user-defined function runs when the AfterFinalRender event occurs
AfterInsertStringIndicates which macro, event procedure, or user-defined function runs when the AfterInsert event occurs
AfterLayoutStringIndicates which macro, event procedure, or user-defined function runs when the AfterLayout event occurs
AfterRenderStringIndicates which macro, event procedure, or user-defined function runs when the AfterRender event occurs
AfterUpdateStringIndicates which macro, event procedure, or user-defined function runs when the event AfterUpdate event occurs
AllowAdditionsBooleanDetermines whether a user can add a record when using a form
AllowDataSheetViewBooleanDetermines whether the form can be switched to datasheet view
AllowDeletionsBooleanDetermines whether a user can delete a record when using a form
AllowDesignChangesBooleanDetermines whether a user can make changes to the design of a form in design mode only (False) or in all views (True)
AllowEditsBooleanDetermines whether a user can edit save records when using a form
AllowFiltersBooleanDetermines whether a user can filter the records when using a form
AllowFormViewBooleanDetermines whether a form can be viewed in Form view
AllowPivotChartViewBooleanDetermines whether a form can be viewed in PivotChart view
AllowPivotTableViewBooleanDetermines whether a form can be viewed in PivotTable view
ApplicationApplication objectReturns the currently active application object
AutoCenterBooleanDetermines whether the form will be automatically centered within the Application window
AutoResizeBooleanDetermines whether the form will be automatically resized to display complete records
BeforeDelConfirmStringIndicates which macro, event procedure, or user-defined function runs when the BeforeDelConfirm event occurs
BeforeInsertStringIndicates which macro, event procedure, or user-defined function runs when the BeforeInsert event occurs
BeforeQueryStringIndicates which macro, event procedure, or user-defined function runs when the BeforeQuery event occurs
BeforeRenderStringIndicates which macro, event procedure, or user-defined function runs when the BeforeRender event occurs
BeforeScreenTipStringIndicates which macro, event procedure, or user-defined function runs when the BeforeScreenTip event occurs
BeforeUpdateStringIndicates which macro, event procedure, or user-defined function runs when the BeforeUpdate event occurs
BookmarkVariantUsed to set a bookmark that identifies a particular record in the form's underlying table'
BorderStyleByteSpecifies the type of border and border elements for the form
CaptionStringSpecifies text that appears in the Form's title bar
ChartSpaceChartSpace objectReturns a ChartSpace object
CloseButtonBooleanSpecifies whether the Close button on a form is enabled
CommandBeforeExecuteStringIndicates which macro, event procedure, or user-defined function runs when the CommandBeforeExecute event occurs
CommandCheckedStringIndicates which macro, event procedure, or user-defined function runs when the CommndChecked event occurs
CommandEnabledStringIndicates which macro, event procedure, or user-defined function runs when the CommandEnabled event occurs
CommandExecuteStringIndicates which macro, event procedure, or user-defined function runs when the CommandExecute event occurs
ControlBoxBooleanSpecifies whether the form has a control menu (in form and datasheet view only)
ControlsControls collectionReturns the collection of all controls on the form
CountIntegerDetermines the number of items in a collection
CurrentRecordLongUsed to identify the current record being viewed on a form
CurrentSectionLeftIntegerThe distance in twips from the left side of the current section to the left side of the form
CurrentSectionTopIntegerThe distance in twips from the top of the current section to the top of the form
CurrentViewIntegerDetermines how a form is displayed (design view, form view, or datasheet view)
CycleByteSpecifies what happens when you press the Ta b key while the last control on the form has the focus
DataChangeStringIndicates which macro, event procedure, or user-defined function runs when the DataChange event occurs
DataEntryBooleanSpecifies whether a bound form only allows data entry (if true the form opens showing only a blank record)
DataSetChangeStringIndicates which macro, event procedure, or user-defined function runs when the DataSetChange event occurs
DataSheetBackColorLongSpecifies the background color of a table, query, or form in datasheet view
DataSheetBorderLineStyleByteIndicates the style used for the border of the datasheet
DataSheetCellsEffectByteIndicates whether special effects are applied to cells in a datasheet
DatasheetColumnHeader-UnderlineStyleByteIndicates the style to use for the bottom edge of the column headers on the datasheet
DatasheetFontHeightIntegerIndicates the font point size used to display and print field names and data on the form's datasheet
DatasheetFontItalicBooleanIndicates whether the font used on the form's datasheet is italicized
DatasheetFontNameStringSpecifies the font used in the datasheet of the form
DatasheetFontUnderlineBooleanIndicates whether the font used on the form's datasheet is underlined
DatasheetFontWeightIntegerUsed to indicate the line width for the font used in the form's datasheet view
DatasheetForeColorLongUsed to indicate the default font color for a form's datasheet view
DatasheetGridlinesBehaviorByteUsed to specify which gridlines appear in a form's datasheet view
DatasheetGridlinesColorLongUsed to determine the color of gridlines in a form's datasheet view
DefaultControlControl objectCan be used to specify the properties of a particular type of control on a form
DefaultViewIntegerUsed to specify the opening view for a form
DirtyBooleanTrue if data has been entered but not saved on a form
DividingLinesBooleanSpecifies whether dividing lines separate sections on a form
FastLaserPrintingBooleanSpecifies whether lines and rectangles are replaced by text character lines to speed printing
FetchDefaultsBooleanIndicates whether Access shows default values for new rows on the form before the row is saved
FilterStringUsed to specify a subset of records to be displayed when a filter is applied to a form
FilterOnBooleanSpecifies whether the Filter property of a form is applied
FormForm objectUsed to refer to the form
FrozenColumnsIntegerDetermines how many columns in a datasheet are frozen
GridXIntegerSpecifies the horizontal divisions of the alignment grid in the form's design view
GridYIntegerSpecifies the vertical divisions of the alignment grid in the form's design view
HasModuleBooleanDetermines whether the form has a class module
HelpContextIDLongSpecifies the context ID of a topic in the custom help file
HelpFileStringReturns the name of the help file associated with the form
HorizontalDatasheet-GridlineStyleByteIndicates the horizontal gridline style for a form's datasheet
HwindLongUsed to determine the handle of the current window
InputParametersStringCan be used to specify the input parameters passed to a SQL statement in the RecordSource property of a form
InsideHeightLongHeight in twips of the window containing the form
InsideWidthLongWidth in twips of the window containing the form
KeyPreviewBooleanSpecifies whether the form level keyboard event procedures are invoked before a control's keyboard event procedures
LayoutForPrintBooleanSpecifies whether the form uses printer (True) or screen (False) fonts
MaxRecButtonBooleanDetermines if the maximum record limit button is available on the navigation bar of a form
MaxRecordsLongSpecifies the maximum number of records returned
MenuBarStringSpecifies the menu bar to use for a form
MinMaxButtonsByteSpecifies whether the Maximize and Minimize buttons are visible on the form
ModalBooleanSpecifies whether a form opens as a modal window
ModuleModule objectUsed to specify a form module
MouseWheelStringIndicates which macro, event procedure, or user-defined function runs when the MouseWheel event occurs
MovableBooleanTrue if a form can be moved by the user
NameStringName of the current form
NavigationButtonsBooleanIndicates whether navigation buttons and the record number box are displayed on a form
NewRecordIntegerDetermines whether the current record is a new record
OnActivateStringIndicates which macro, event procedure, or user-defined function runs when the OnActivate event occurs
OnApplyFilterStringIndicates which macro, event procedure, or user-defined function runs when the OnApplyFilter event occurs
OnClickStringIndicates which macro, event procedure, or user-defined function runs when the OnClick event occurs
OnCloseStringIndicates which macro, event procedure, or user-defined function runs when the OnClose event occurs
OnConnectStringIndicates which macro, event procedure, or user-defined function runs when the OnConnect event occurs
OnCurrentStringIndicates which macro, event procedure, or user-defined function runs when the OnCurrent event occurs
OnDblClickStringIndicates which macro, event procedure, or user-defined function runs when the OnDblClick event occurs
OnDeactivateStringIndicates which macro, event procedure, or user-defined function runs when the OnDeactivate event occurs
OnDeleteStringIndicates which macro, event procedure, or user-defined function runs when the OnDelete event occurs
OnDirtyStringIndicates which macro, event procedure, or user-defined function runs when the OnDirty event occurs
OnDisconnectStringIndicates which macro, event procedure, or user-defined function runs when the OnDisconnect event occurs
OnErrorStringIndicates which macro, event procedure, or user-defined function runs when the OnError event occurs
OnFilterStringIndicates which macro, event procedure, or user-defined function runs when the OnFilter event occurs
OnGotFocusStringIndicates which macro, event procedure, or user-defined function runs when the OnGotFocus event occurs
OnInsertStringIndicates which macro, event procedure, or user-defined function runs when the OnInsert event occurs
OnKeyDownStringIndicates which macro, event procedure, or user-defined function runs when the OnKeyDown event occurs
OnKeyPressStringIndicates which macro, event procedure, or user-defined function runs when the OnKeyPress event occurs
OnKeyUpStringIndicates which macro, event procedure, or user-defined function runs when the OnKeyUp event occurs
OnLoadStringIndicates which macro, event procedure, or user-defined function runs when the OnLoad event occurs
OnLostFocusStringIndicates which macro, event procedure, or user-defined function runs when the OnLostFocus event occurs
OnMenuStringIndicates which macro, event procedure, or user-defined function runs when the OnMenu event occurs
OnMouseDownStringIndicates which macro, event procedure, or user-defined function runs when the OnMouseDown event occurs
OnMouseMoveStringIndicates which macro, event procedure, or user-defined function runs when the OnMouseMove event occurs
OnMouseUpStringIndicates which macro, event procedure, or user-defined function runs when the OnMouseUp event occurs
OnOpenStringIndicates which macro, event procedure, or user-defined function runs when the OnOpen event occurs
OnResizeStringIndicates which macro, event procedure, or user-defined function runs when the OnResize event occurs
OnTimerStringIndicates which macro, event procedure, or user-defined function runs when the OnTimer event occurs
OnUndoStringIndicates which macro, event procedure, or user-defined function runs when the OnUndo event occurs
OnUnloadStringIndicates which macro, event procedure, or user-defined function runs when the OnUnload event occurs
OpenArgsVariantDetermines the string expression specified by the OpenArgs method of the OpenForm method
OrderByStringSpecifies how records on a form should be shortened
OrderByOnBooleanSpecifies whether a form's OrderBy property is applied
OrientationByteSpecifies the form's orientation (left to right or right to left)
PageLongSpecifies the current page number when a form is being printed
PagesIntegerReturns information needed to print page numbers on a form
PaintingBooleanSpecifies whether forms are repainted
PaintPaletteVariantSpecifies the palette used by a form
PaletteSourceStringUsed to specify the palette for the form
ParentApplication objectThe Application object is the parent of the form
PictureStringCan be used to specify a bitmap on a form
PicturePaletteStringContains the palette information
PictureTypeByteUsed to specify if the picture is stored as a linked (1) or embedded (0) object
PictureAlignmentByteSpecifies where a background picture appears in an image control on a form
PictureDataVariantCan be used to copy the picture in a form to another object
PictureSizeModeIntegerSpecifies how a picture on a form is sized
PictureTilingBooleanSpecifies whether a background picture is tiled across the entire form
PivotTablePivotTable objectReturns a specific PivotTable on the form
PivotTableChangeStringIndicates which macro, event procedure, or user-defined function runs when the PivotTableChange event occurs
PopUpBooleanSpecifies whether a form opens in a pop-up window
PrinterPrinter objectRepresents the default printer on the current system
PropertiesProperties collectionCollection of all properties of the form
PrtDevModeVariantSets or returns the printing device mode information for the form in the Print dialog box
PrtDevNamesVariantSets or returns information about the printer selected in the Print dialog box
PrtMipVariantSets or returns the printing device mode information for the form in the Print dialog
QueryStringIndicates which macro, event procedure, or user-defined function runs when the Query event occurs
RecordLocksIntegerDetermines how records are locked and what happens when two users try to edit the same record at the same time
RecordSelectorsBooleanDetermines whether a form displays record selectors in form view
RecordsetRecordset objectReturns the recordset object for the form
RecordsetCloneRecordset objectCan be used to refer to a form's recordset specified by the form's RecordSource property
RecordsetTypeIntegerSpecifies the type of recordset is used within the form
RecordSourceStringUsed to specify the source of the data for the form
RecordSourceQualifierStringReturns or sets a string indicating the SQL Server owner name of the record source for the form
ResyncCommandStringUsed to specify the SQL statement or stored procedure used in an update snapshot of a table
RowHeightIntegerSpecifies the height of rows in a form's datasheet view
ScrollBarsByteSpecifies whether scrollbars appear on a form
SectionSection objectUsed to identify a section of a form
SelectionChangeStringIndicates which macro, event procedure, or user-defined function runs when the SelectionChange event occurs
SelHeightLongSpecifies the number of selected rows or records in the current selection rectangle in a form's datasheet
SelLeftLongSpecifies which column is leftmost in the current selection rectangle in the form's datasheet
SelTopLongSpecifies which row is topmost in the current selection rectangle in the form's datasheet
SelWidthLongSpecifies the number of selected columns in the current selection rectangle in the form's datasheet
ServerFilterStringUsed to specify a subset of records displayed when a server filter is applied
ServerFilterByFormBooleanSpecifies whether a form is opened in the Server Filter By Form window
ShortcutMenuBooleanSpecifies whether a shortcut menu is displayed when you right-click an object on a form
ShortcutMenuBarStringSpecifies the shortcut menu that appears when you right-click a form
SubdatasheetExpandedBooleanSpecifies the saved state of all subdatasheets within a form
SubdatasheetHeightIntegerDetermines the display height of a subdatasheet when expanded
TagStringStores extra information about a form
TimerIntervalLongSpecifies the interval (in milliseconds) between Timer events on a form
ToolbarStringSpecifies the toolbar used for a form
UniqueTableStringIdentifies the "most many" table of a join of a data source of a form
UseDefaultPrinterBooleanDetermines whether the form uses the system's default printer
VerticalDatasheet-GridlineStyleByteSpecifies the line style to use for vertical gridlines within the form's datasheet
ViewChangeStringIndicates which macro, event procedure, or user-defined function runs when the ViewChange event occurs
ViewsAllowedByteSpecifies whether users can switch between form and datasheet views
VisibleBooleanTrue when the form isn't minimized
WhatsThisButtonBooleanSpecifies whether a What's This button is displayed on a toolbar
WidthIntegerWidth of the form in twips
WindowHeightIntegerSpecifies the height of a form in twips
WindowLeftIntegerIndicates the screen position in twips of the left edge of the form relative to the left edge of the Access window
WindowTopIntegerSpecifies the screen position in twips of the top edge of the form relative to the top edge of the Access window
WindowWidthIntegerSets the width of the form in twips

E.14.2. Methods of the Form Object

The Form object also has a number of methods you can use within your code. Those methods are listed in the following table.

MethodArgumentsDescription
GoToPagePageNumber, Right, DownMoves the focus to the first control on a specified page in the current form
MoveLeft, Top, Width, HeightMoves the form to the specified coordinates
RecalcNoneImmediately updates the calculated controls on a form
RefreshNoneImmediately updates the records in the underlying record source for a form
RepaintNoneCompletes any pending screen updates for the current form
RequeryNoneUpdates the data in the form from the underlying recordset
SetFocusNoneSets the focus to the current form
UndoNoneUsed to reset the value of a form when it has been changed

E.14.3. Events of the Form Object

There are a large number of events you'll use within your code behind forms. You probably will only use a handful of these events, but they are all available for you when writing code. A Form's events are summarized in the following table.

EventDescription
ActivateOccurs when the form receives focus and becomes the active window
AfterDelConfirmOccurs after the user confirms the delete and the records are actually deleted
AfterFinalRenderOccurs after all elements in the PivotChart have been rendered
AfterInsertOccurs after a new record is added
AfterLayoutOccurs after all charts in the PivotChart have been laid out but before they have been rendered
AfterRenderOccurs after an object represented by the ChartObject has been rendered
AfterUpdateOccurs after changed data in a control or record is updated
ApplyFilterOccurs when a filter is applied to a form
BeforeDelConfirmOccurs after the user deletes records but before the delete confirmation dialog is displayed
BeforeInsertOccurs when the user types the first character in a new record
BeforeQueryOccurs when the specified PivotTable queries its data source
BeforeRenderOccurs before any object in the specified PivotChart has been rendered
BeforeScreenTipOccurs before a screen tip is displayed for an element in a PivotChart or PivotTable view
BeforeUpdateOccurs before changed data in a control is updated
ClickOccurs when a user presses and releases the mouse button over an object
CloseOccurs when a form is closed and removed from the screen
CommandBeforeExecuteOccurs before a specified command is executed
CommandCheckedOccurs when the specified Microsoft Office Web Component determines whether the specified command is checked
CommandEnabledOccurs when the specified Microsoft Office Web Component determines whether the specified command is enabled
CommandExecuteOccurs after the specified command is executed
CurrentOccurs when the focus moves to a record or when the form is refreshed or requeried
DataChangeOccurs when certain properties are changed or when certain methods are executed
DataSetChangeOccurs whenever the specified PivotTable view is data-bound and the dataset changes
DblClickOccurs when a user presses and releases the mouse button twice in rapid succession over an object
DeactivateOccurs when a form loses focus to another object
DeleteOccurs when the user presses the Delete key, but before the record is actually deleted
DirtyOccurs when data has changed on the form, but the current record hasn't been saved
ErrorOccurs when a runtime error occurs when the form has the focus
FilterOccurs when a user chooses the Filter By Form option from the Filter menu or clicks the Filter By Form button on the toolbar
GotFocusOccurs when the form receives the focus
KeyDownOccurs when a key is depressed
KeyPressOccurs when a key is pressed and released
KeyUpOccurs when a key is released
LoadOccurs when a form is opened and records are displayed
LostFocusOccurs when the form loses focus to another object
MouseDownOccurs when the mouse button is depressed
MouseMoveOccurs when the user moves the mouse
MouseUpOccurs when the mouse button is released
MouseWheelOccurs when the mouse wheel is moved
OnConnectOccurs when the PivotTable view connects to a data source
OnDisconnectOccurs when a PivotTable view disconnects from a data source
OpenOccurs when a form is opened but before the first record is displayed
PivotTableChangeOccurs whenever the specified PivotTable view field, field set, or total is added or deleted
QueryOccurs whenever the specified PivotTable view query becomes necessary
ResizeOccurs when a form opens and any time it is resized
SelectionChangeOccurs whenever a user makes a new selection in a PivotChart or PivotTable view
TimerOccurs at regular intervals controlled by the form's TimerInterval property
UndoOccurs when the user undoes a change to a control on a form
UnloadOccurs after a form is closed but before it's removed from the screen
ViewChangeOccurs whenever the specified PivotChart view or PivotTable view is redrawn

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.206.68