Sign in with Microsoft
Sign in or create an account.
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

You can use the OpenForm macro action in Access to open a form in Form view, Design view, Print Preview, or Datasheet view. You can select data entry and window modes for the form and restrict the records that the form displays.

Note: The OpenForm macro action isn't available in Access web apps.


The OpenForm action has the following arguments.

Action argument


Form Name

The name of the form to open. The Form Name box displays a drop-down list of all forms in the current database. This is a required argument.

If you run a macro containing the OpenForm action in a library database, Access first looks for the form with this name in the library database, and then in the current database.


The view in which the form will open. Select Form, Design, Print Preview, or Datasheet in the View box. The default is Form.

Note: The View argument setting overrides the settings of the form's DefaultView and ViewsAllowed properties. For example, if a form's ViewsAllowed property is set to Datasheet, you can still use the OpenForm action to open the form in Form view.

Filter Name

A filter that restricts or sorts the form's records. You can enter the name of either an existing query or a filter that was saved as a query. However, the query must include all the fields in the form you are opening or have its OutputAllFields property set to Yes.

Where Condition

A valid SQL WHERE clause (without the word WHERE) or expression that Access uses to select records from the form's underlying table or query. If you select a filter with the Filter Name argument, Access applies this WHERE clause to the results of the filter.

To open a form and restrict its records to those specified by the value of a control on another form, use the following expression:

[ fieldname ] = Forms![ formname ]![ controlname on other form ]

Replace fieldname with the name of a field in the underlying table or query of the form you want to open. Replace formname and controlname on other form with the name of the other form and the control on the other form that contains the value you want records in the first form to match.

Note: The maximum length of the Where Condition argument is 255 characters. If you need to enter a more complex SQL WHERE clause longer than this, use the OpenForm method of the DoCmd object in a Visual Basic for Applications (VBA) module instead. You can enter SQL WHERE clause statements of up to 32,768 characters in VBA.

Data Mode

The data entry mode for the form. This applies only to forms opened in Form view or Datasheet view. Select Add (the user can add new records but can't edit existing records), Edit (the user can edit existing records and add new records), or Read Only (the user can only view records).


  • The Data Mode argument setting overrides the settings of the form's AllowEdits, AllowDeletions, AllowAdditions, and DataEntry properties. For example, if a form's AllowEdits property is set to No, you can still use the OpenForm action to open the form in Edit mode.

  • If you leave this argument blank, Access opens the form in the data entry mode set by the form's AllowEdits, AllowDeletions, AllowAdditions, and DataEntry properties.

Window Mode

The window mode in which the form opens. Select Normal (the form opens in the mode set by its properties), Hidden (the form is hidden), Icon (the form opens minimized as a small title bar at the bottom of the screen), or Dialog (the form's Modal and PopUp properties are set to Yes). The default is Normal.

Note: Some Window Mode argument settings do not apply when using tabbed documents. To switch to overlapping windows:

  1. Click File and then click Options

  2. In the Access Options dialog box, click Current Database.

  3. In the Application Options section, under Document Window Options, click Overlapping Windows.

  4. Click OK, then close and reopen the database.


This macro action is similar to double-clicking a form in the Navigation Pane, or right-clicking the form in the Navigation Pane and then selecting a view.

A form can be modal (it must be closed or hidden before the user can perform any other action) or modeless (the user can move to other windows while the form is open). It can also be a pop-up form (a form used to collect or display information that remains on top of all other Access windows). You set the Modal and PopUp properties when you design the form. If you use Normal for the Window Mode argument, the form opens in the mode specified by these property settings. If you use Dialog for the Window Mode argument, these properties are both set to Yes. A form opened as hidden or as an icon returns to the mode specified by its property settings when you show or restore it.

When you open a form with the Window Mode argument set to Dialog, Access suspends the macro until the form is closed or hidden. You can hide a form by setting its Visible property to No by using the SetValue action.

The filter and WHERE condition you apply become the setting of the form's Filter property.

Tip: You can select a form in the Navigation Pane and drag it onto the macro window. This automatically creates an OpenForm action that opens the selected form in Form view.


Set the value of a control on a form being opened by using a macro

The following macro opens the Products form from a button on the Suppliers form. It shows the use of the Echo, OpenForm, SetValue, and GoToControl actions. The SetValue action sets the Supplier ID control on the Products form to the current supplier on the Suppliers form. The GoToControl action then moves the focus to the Category ID field, where you can begin to enter data for the new product. This macro should be attached to the Add Products button on the Suppliers form.


Arguments: Setting



Echo On: No

Stop screen updating while the macro is running.


Form Name: Products

View: Form

Data Mode: Add

Window Mode: Normal

Open the Products form.


Item: [Forms]![Products]![SupplierID]

Expression: SupplierID

Set the Supplier ID control to the current supplier on the Suppliers form.


Control Name: CategoryID

Go to the Category ID control.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!