Class Form (Access VBA)

A Form object refers to a particular Microsoft Access form.

The classes Application, Control, Screen and SubForm. give access to class Form

Methods

Refresh - The Refresh method immediately updates the records in the underlying record source for a specified form or datasheet to reflect changes made to the data by you and other users in a multiuser environment.


Private Sub Form_Activate() 
    Me.Refresh 
End Sub

Requery - The Requery method updates the data underlying a specified form by requerying the source of data for the form.


Public Sub RequeryList() 
 
    Dim ctlCombo As Control 
 
    ' Return Control object pointing to a combo box. 
    Set ctlCombo = Forms!Employees!ReportsTo 
 
    ' Requery source of data for list box. 
    ctlCombo.Requery 
 
End Sub

GoToPage - The GoToPage method moves the focus to the first control on a specified page in the active form.

Move - Moves the specified object to the coordinates specified by the argument values.

Recalc - The Recalc method immediately updates all calculated controls on a form.

Repaint - The Repaint method completes any pending screen updates for a specified form. When performed on a form, the Repaint method also completes any pending recalculations of the form's controls.

SetFocus - The SetFocus method moves the focus to the specified form, the specified control on the active form, or the specified field on the active datasheet.

Undo - You can use the Undo method to reset a control or form when its value has been changed.

Properties

Controls (Default member) - Returns the Controls collection of a form, subform, report, or section.

ActiveControl you can use the ActiveControl property together with the Screen object to identify or refer to the control that has the focus.

AfterDelConfirm

AfterFinalRender

AfterInsert

AfterLayout

AfterRender

AfterUpdate

AllowAdditions you can use the AllowAdditions property to specify whether a user can add a record when using a form.

AllowDatasheetView returns or sets a Boolean indicating whether the specified form may be viewed in Datasheet view. True if Datasheet view is allowed.

AllowDeletions you can use the AllowDeletions property to specify whether a user can delete a record when using a form.

AllowEdits you can use the AllowEdits property to specify whether a user can edit saved records when using a form.

AllowFilters you can use the AllowFilters property to specify whether records in a form can be filtered.

AllowFormView returns or sets a Boolean indicating whether the specified form may be viewed in Form view. True if Form view is allowed.

AllowLayoutView gets or sets whether the specified form can be used in Layout view.

AllowPivotChartView returns or sets a Boolean indicating whether the specified form may be viewed in PivotChart view. True if PivotChart view is allowed.

AllowPivotTableView returns or sets a Boolean indicating whether the specified form may be viewed in PivotTable view. True if PivotTable view is allowed.

AutoCenter returns or sets a Boolean indicating whether a form will be centered automatically in the application window when the form is opened.

AutoResize returns or sets a Boolean indicating whether a Form window opens automatically sized to display complete records.

BeforeDelConfirm

BeforeInsert

BeforeQuery

BeforeRender

BeforeScreenTip

BeforeUpdate

Bookmark you can use the Bookmark property with forms to set a bookmark that uniquely identifies a particular record in the form's underlying table, query, or SQL statement.

BorderStyle specifies the type of border and border elements (title bar, Control menu, Minimize and Maximize buttons, or Close button) to use for the form. You typically use different border styles for normal forms, pop-up forms, and custom dialog boxes.

Caption gets or sets the text that appears in the title bar in Form view.

ChartSpace returns a ChartSpace object.

CloseButton specifies whether the Close button on a form is enabled.

CommandBeforeExecute

CommandChecked

CommandEnabled

CommandExecute

ControlBox specifies whether a form has a Control menu in Form view and Datasheet view.

Count you can use the Count property to determine the number of items in a specified collection.

CurrentRecord you can use the CurrentRecord property to identify the current record in the recordset being viewed on a form.

CurrentSectionLeft you can use this property to determine the distance in twips from the left side of the current section to the left side of the form.

CurrentSectionTop you can use this property to determine the distance in twips from the top edge of the current section to the top edge of the form.

CurrentView you can use the CurrentView property to determine how a form is currently displayed.

Cycle you can use the Cycle property to specify what happens when you press the Tab key and the focus is in the last control on a bound form.

DataChange

DataEntry you can use the DataEntry property to specify whether a bound form opens to allow data entry only. The Data Entry property doesn't determine whether records can be added; it only determines whether existing records are displayed.

DataSetChange

DatasheetAlternateBackColor gets or sets the color displayed on alternate rows of a form's datasheet.

DatasheetBackColor you can use the DatasheetBackColor property in Visual Basic to specify or determine the background color of an entire table, query, or form in Datasheet view within a Microsoft Access database.

DatasheetBorderLineStyle returns or sets a Byte indicating the line style to use for the border of the specified datasheet.

DatasheetCellsEffect you can use the DatasheetCellsEffect property to specify whether special effects are applied to cells in a datasheet.

DatasheetColumnHeaderUnderlineStyle returns or sets a Byte indicating the line style to use for the bottom edge of the column headers on the specified datasheet.

DatasheetFontHeight you can use the DatasheetFontHeight property to specify the font point size used to display and print field names and data in Datasheet view.

DatasheetFontItalic you can use the DatasheetFontItalic property to specify an italicized appearance for field names and data in Datasheet view.

DatasheetFontName you can use the DatasheetFontName property to specify the font used to display and print field names and data in Datasheet view.

DatasheetFontUnderline you can use the DatasheetFontUnderline property to specify an underlined appearance for field names and data in Datasheet view.

DatasheetFontWeight you can use the DatasheetFontWeight property to specify the line width of the font used to display and print characters for field names and data in Datasheet view.

DatasheetForeColor you can use the DatasheetForeColor property in Visual Basic to specify or determine the color of all text in a table, query, or form in Datasheet view within an Access database.

DatasheetGridlinesBehavior you can use the DatasheetGridlinesBehavior property to specify which gridlines will appear in Datasheet view.

DatasheetGridlinesColor you can use the DatasheetGridlinesColor property to specify the color of gridlines in a datasheet.

DefaultControl the DefaultControl property returns a Control object with which you can set the default properties for a particular type of control on a particular form.

DefaultView you can use the DefaultView property to specify the opening view of a form.

Dirty

DisplayOnSharePointSite gets or sets whether the specified form can be made available as a view on a Microsoft SharePoint Foundation site.

DividingLines you can use the DividingLines property to specify whether dividing lines will separate sections on a form or records displayed on a continuous form.

FastLaserPrinting you can use the FastLaserPrinting property to specify whether lines and rectangles are replaced by text character lines, similar to the underscore ( _ ) and vertical bar ( | ) characters, when you print a form by using most laser printers. Replacing lines and rectangles with text character lines can make printing much faster.

FetchDefaults returns or sets a Boolean indicating whether Microsoft Access shows default values for new rows on the specified form before the row is saved. True if Access shows the default values for new rows on the specified form.

Filter

FilterOn you can use the FilterOn property to specify or determine whether the Filter property for a form or report is applied.

FilterOnLoad gets or sets whether the filter specified by the Filter property is applied when the form is loaded.

FitToScreen gets or sets whether the width of the form is reduced to fit the width of the screen.

Form you can use the Form property to refer to a form or to refer to the form associated with a subformcontrol.

FrozenColumns you can use the FrozenColumns property to determine how many columns in a datasheet are frozen.

GridX you can use the GridX property (along with the GridY property) to specify the horizontal and vertical divisions of the alignment grid in form Design view.

GridY you can use the GridY property (along with the GridX property) to specify the horizontal and vertical divisions of the alignment grid in form Design view.

HasModule you can use the HasModule property to specify or determine whether a form or report has a class module.

HelpContextId the HelpContextID property specifies the context ID of a topic in the custom Help file specified by the HelpFile property setting.

HelpFile the name of a help file associated with a form.

HorizontalDatasheetGridlineStyle returns or sets a Byte indicating the line style to use for horizontal gridlines on the specified datasheet.

Hwnd you can use the hWnd property to determine the handle (a unique Long Integer value) assigned by Windows to the current window.

InputParameters you can use the InputParameters property to specify or determine the input parameters that are passed to a SQL statement in the RecordSource property of a form or report, or a stored procedure when used as the record source within a Microsoft Access project (.adp).

InsideHeight you can use the InsideHeight property (along with the InsideWidth property) to determine the height and width (in twips) of the window containing a form.

InsideWidth you can use the InsideWidth property (along with the InsideHeight property) to determine the height and width (in twips) of the window containing a form.

KeyPreview you can use the KeyPreview property to specify whether the form-level keyboard event procedures are invoked before a control's keyboard event procedures.

LayoutForPrint you can use the LayoutForPrint property to specify whether the form uses printer or screen fonts.

MaxRecButton you can use the MaxRecButton property to specify or determine if the maximum record limit button is available on the navigation bar of a form in Datasheet view or Form view.

MaxRecords specifies the maximum number of records by a query or view.

MenuBar specifies a custom menu to display for a form.

MinMaxButtons you can use the MinMaxButtons property to specify whether the Maximize and Minimize buttons will be visible on a form.

Modal you can use the Modal property to specify whether a form opens as a modal window. When a form opens as a modal window, you must close the window before you can move the focus to another object.

Module you can use the Module property to specify a form module.

MouseWheel

Moveable returns or sets a Boolean indicating whether the specified form can be moved by the user; True if it can be moved.

Name you can use the Name property to specify or determine the string expression that identifies the name of an object.

NavigationButtons you can use the NavigationButtons property to specify whether navigation buttons and a record number box are displayed on a form.

NavigationCaption gets or sets the text that appears to the left of the form's navigation buttons.

NewRecord you can use the NewRecord property to determine whether the current record is a new record.

OnActivate sets or returns the value of the On Activate box in the Properties window of a form or report.

OnApplyFilter sets or returns the value of the On Apply Filter box in the Properties window of a form.

OnClick sets or returns the value of the On Click box in the Properties window.

OnClose sets or returns the value of the On Close box in the Properties window of a form or report.

OnConnect

OnCurrent sets or returns the value of the On Current box in the Properties window of a form.

OnDblClick sets or returns the value of the On Dbl Click box in the Properties window.

OnDeactivate sets or returns the value of the On Deactivate box in the Properties window of a form or report.

OnDelete sets or returns the value of the On Delete box in the Properties window of a form.

OnDirty sets or returns the value of the On Dirty box in the Properties window of a form or report.

OnDisconnect

OnError sets or returns the value of the On Error box in the Properties window of a form or report.

OnFilter sets or returns the value of the On Filter box in the Properties window of a form.

OnGotFocus sets or returns the value of the On Got Focus box in the Properties window of the specified object.

OnInsert sets or returns the value of the Before Insert box in the Properties window of a form.

OnKeyDown sets or returns the value of the On Key Down box in the Properties window.

OnKeyPress sets or returns the value of the On Key Press box in the Properties window.

OnKeyUp sets or returns the value of the On Key Up box in the Properties window.

OnLoad sets or returns the value of the On Load box in the Properties window of a form.

OnLostFocus sets or returns the value of the On Lost Focus box in the Properties window of the specified object.

OnMouseDown sets or returns the value of the On Mouse Down box in the Properties window.

OnMouseMove sets or returns the value of the On Mouse Move box in the Properties window.

OnMouseUp sets or returns the value of the On Mouse Up box in the Properties window.

OnOpen sets or returns the value of the On Open box in the Properties window of a form or report.

OnResize sets or returns the value of the On Resize box in the Properties window of a form.

OnTimer sets or returns the value of the On Timer box in the Properties window of a form.

OnUndo returns or sets a String indicating which macro, event procedure, or user-defined function runs when the Undo event occurs.

OnUnload sets or returns the value of the On Unload box in the Properties window of a form.

OpenArgs determines the string expression specified by the OpenArgs argument of the OpenForm method that opened a form.

OrderBy you can use the OrderBy property to specify how you want to sort records in a form.

OrderByOn you can use the OrderByOn property to specify whether an object's OrderBy property setting is applied.

OrderByOnLoad gets or sets whether the sorting specified by the OrderBy property is applied when the form is loaded.

Orientation you can use the Orientation property to specify or determine the view orientation.

Page the Page property specifies the current page number when a form is being printed.

Pages you can use the Pages property to return information needed to print page numbers in a form.

Painting you can use the Painting property to specify whether a form is repainted.

PaintPalette you can use the PaintPalette property to specify a palette to be used by a form.

PaletteSource you can use the PaletteSource property to specify the palette for a form.

Picture you can use the Picture property to specify a bitmap or other type of graphic to be used as a background picture on a form.

PictureAlignment you can use the PictureAlignment property to specify where a background picture will appear in an image control or on a form or report. Read/write Byte.Read/write.

PictureData you can use the PictureData property to copy the picture to another object that supports the Picture property.

PicturePalette you can use the PicturePalette property to specify a palette to be used by a form.

PictureSizeMode you can use the PictureSizeMode property to specify how a picture for a form or report is sized.

PictureTiling you can use the PictureTiling property to specify whether a background picture is tiled across the entire image control, Form window, form, or page of a report.

PictureType you can use the PictureType property to specify whether Microsoft Access stores an object's picture as a linked or an embedded object.

PivotTable returns a PivotTable object representing a PivotTable view on a form.

PivotTableChange

PopUp specifies whether a form opens as a pop-up window.

Properties returns a reference to a control's Properties collection object.

PrtDevMode you can use the PrtDevMode property to set or return printing device mode information specified for a form or report in the Print dialog box.

PrtDevNames you can use the PrtDevNames property to set or return information about the printer selected in the Print dialog box for a form or report.

PrtMip you can use the PrtMip property in Visual Basic to set or return the device mode information specified for a form or report in the Print dialog box.

Query

RecordLocks you can use the RecordLocks property to determine how records are locked and what happens when two users try to edit the same record at the same time.

RecordSelectors you can use the RecordSelectors property to specify whether a form displays record selectors in Form view.

Recordset returns or sets the ADO Recordset or DAO Recordset recordset that represents the record source for the specified recordset. Read/write recordset.

RecordsetClone you can use the RecordsetClone property to refer to a form's Recordset object specified by the form's RecordSource property.

RecordsetType you can use the RecordsetType property to specify what kind of recordset is made available to a form.

RecordSource you can use the RecordSource property to specify the source of the data for a form.

RecordSourceQualifier returns or sets a String indicating the SQL Server owner name of the record source for the specified form.

ResyncCommand you can use the ResyncCommand property to specify or determine the SQL statement or stored procedure that will be used in an updateable snapshot of a table.

RibbonName gets or sets the name of the customized ribbon to be displayed when the specified form is loaded.

RowHeight you can use the RowHeight property to specify the height of all rows in Datasheet view.

ScrollBars you can use the ScrollBars property to specify whether scroll bars appear on a form.

Section you can use the Section property to identify a section of a form and provide access to the properties of that section.

SelectionChange

SelHeight you can use the SelHeight property to specify or determine the number of selected rows (records) in the current selection rectangle in a table, query, or form datasheet, or the number of selected records in a continuous form.

SelLeft you can use the SelLeft property to specify or determine which column (field) is leftmost in the current selection rectangle.

SelTop you can use the SelTop property to specify or determine which row (record) is topmost in the current selection rectangle in a table, query, or form datasheet, or which selected record is topmost in a continuous form.

SelWidth you can use the SelWidth property to specify or determine the number of selected columns (fields) in the current selection rectangle.

ServerFilter you can use the ServerFilter property to specify a subset of records to be displayed when a server filter is applied to a form within a Microsoft Access project (.adp) or database.

ServerFilterByForm you can use the ServerFilterByForm property to specify or determine whether a form is opened in the Server Filter By Form window.

ShortcutMenu you can use the ShortcutMenu property to specify whether a shortcut menu is displayed when you right-click an object on a form. For example, you might want to disable a shortcut menu to prevent the user from changing the form's underlying record source by using one of the filtering commands on the form's shortcut menu.

ShortcutMenuBar you can use the ShortcutMenuBar property to specify the shortcut menu that appears when you right-click the specified object.

SplitFormDatasheet gets or sets whether the user can edit records in the datasheet when a form is displayed in Split Form view.

SplitFormOrientation gets or sets the position of the datasheet relative to the form when the form is displayed in Split Form view.

SplitFormPrinting gets or sets whether the contents of the form or the datasheet are printed when printing a form displayed in Split Form view.

SplitFormSize gets or sets the size in twips of the form when it's displayed in Split Form view.

SplitFormSplitterBar gets or sets whether the splitter bar is available when the form is displayed in Split Form mode.

SplitFormSplitterBarSave gets or sets whether the location of the splitter bar is saved when a form that's displayed in Split Form mode is closed.

SubdatasheetExpanded you can use the SubdatasheetExpanded property to specify or determine the saved state of all subdatasheets within a table or query.

SubdatasheetHeight you can use the SubdatasheetHeight property to specify or determine the default display height of a subdatasheet when expanded.

Tag stores extra information about a form, report, section, or control needed by a Microsoft Access application.

TimerInterval you can use the TimerInterval property to specify the interval, in milliseconds, between Timer events on a form.

Toolbar specifies a custom toolbar to display for a form.

UniqueTable specifies the table to be updateable when a form is bound to a multiple table view or stored procedure within a Microsoft Access project (.

UseDefaultPrinter returns or sets a Boolean indicating whether the specified form uses the default printer for the system; True if the form or report uses the default printer.

VerticalDatasheetGridlineStyle returns or sets a Byte indicating the line style to use for vertical gridlines on the specified datasheet.

ViewChange

ViewsAllowed you can use the ViewsAllowed property to specify whether users can switch between Datasheet view and Form view by choosing the Form view or Datasheet view command on the View menu, or by choosing the arrow next to the View button and choosing Form view or Datasheet view.

Visible returns or sets whether the object is visible.

Width gets or sets the width of the specified object in twips.

WindowHeight returns the height of a form in twips.

WindowLeft returns an Integer indicating the screen position in twips of the left edge of a form relative to the left edge of the Microsoft Access window.

WindowTop returns an Integer indicating the screen position in twips of the top edge of a form relative to the top of the Microsoft Access window.

WindowWidth returns the width of a form in twips.

Control - The Control object represents a control on a form, report, or section, within another control, or attached to another control.

Controls - The Controls collection contains all of the controls on a form, report, or subform, within another control, or attached to another control. The Controls collection is a member of the Form, Report, and SubForm objects.

Module - A Module object refers to a standard module or a class module.

Properties - The Properties collection contains all the built-in properties in an instance of an open form, report, or control. These properties uniquely characterize that instance of the object.

Section - A form section is part of a form such as a header, footer, or detail section.