OpenFunction Method

Microsoft Access Visual Basic

expression.OpenFunction(FunctionName, View, DataMode)

expression    Required. An expression that returns a DoCmd object.

FunctionName   Required Variant. The name of the function to open.

View   Optional AcView. The view in which to open the function.

AcView can be one of these AcView constants.
acViewDesign Opens the function in Design View.
acViewNormal default Opens the function in Datasheet View.
acViewPivotChart Opens the function in PivotChart View.
acViewPivotTable Opens the function in PivotTable View.
acViewPreview Opens the function in Print Preview.

DataMode   Optional AcOpenDataMode. The mode in which to open the function.

AcOpenDataMode can be one of these AcOpenDataMode constants.
acAdd Opens the function for data entry.
acEdit default Opens the function for updating existing data.
acReadOnly Opens the function in read-only mode.

Remarks

Use the AllFunctions collection to retrieve information about the available user-defined functions in a SQL Server database.

Example

The following example opens the first user-defined function in the current database in Design View and read-only mode.

Dim objFunction As AccessObject
Dim strFunction As String

Set objFunction = Application.AllFunctions(0)

DoCmd.OpenFunction FunctionName:=objFunction.Name, _
    View:=acViewDesign, Mode:=acReadOnly