Share via


OpenFunction Method [Access 2003 VBA Language Reference]

Opens a user-defined function in a Microsoft SQL Server database for viewing in Microsoft Access.

expression.OpenFunction(FunctionName, View, DataMode)

expression Required. An expression that returns a DoCmd object.

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

AcView

AcView can be one of these AcView constants.
acViewDesign Opens the function in Design View.
acViewNormaldefault 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.

AcOpenDataMode

AcOpenDataMode can be one of these AcOpenDataMode constants.
acAdd Opens the function for data entry.
acEditdefault 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

Applies to | DoCmd Object

See Also | AllFunctions Collection | AllFunctions Property