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

In an Access project (*.adp), you can use the OpenFunction macro action to open a user-defined function in Datasheet view, inline function Design view, SQL Text Editor view (for a scalar or table user-defined function), or Print Preview. This action runs the user-defined function when opened in Datasheet view. You can also select the data entry mode for the user-defined function and restrict the records that the user-defined function displays.

Note: This action will not be allowed if the database is not trusted.

Note: Access 2010 is the last version that supports Access data projects.

Setting

The OpenFunction macro action has the following arguments.

Action argument

Description

Function Name

The name of the user-defined function to open. The Function Name box displays all user-defined functions in the current database. This is a required argument.

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

View

The view in which the user-defined function will open. Select Datasheet, Design, Print Preview, PivotTable, or PivotChart in the View box. The default is Datasheet.

Data Mode

The data entry mode for the user-defined function. This applies only to user-defined functions opened in Datasheet view. Select Add (the user can add new records but can't view or edit existing records), Edit (the user can view or edit existing records and add new records), or Read Only (the user can only view records). The default is Edit.

Remarks

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

Switching to Design view while the user-defined function is open removes the Data Mode argument setting for the user-defined function. This setting is not in effect, even if the user returns to Datasheet view.

Tips    

  • You can select a user-defined function in the Navigation Pane and drag it onto the macro design window. This automatically creates an OpenFunction action that opens the user-defined function in Datasheet view.

  • If you don't want to display the system messages that normally appear when a user-defined function is run (indicating it is a user-defined function and showing how many records will be affected), you can use the SetWarnings macro action to suppress the display of these messages.

To run the OpenFunction macro action in a Visual Basic for Applications (VBA) module, use the OpenFunction method of the DoCmd object.

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!

×