OpenStoredProcedure Action

OpenStoredProcedure Action

See Also        

You can use the OpenStoredProcedure action to open a stored procedure in Datasheet view, stored procedure Design view, or Print Preview. This action runs the named stored procedure when opened in Datasheet view.You can select data entry for the stored procedure and restrict the records that the stored procedure displays.

Setting

The OpenStoredProcedure action has the following arguments.

Action argument Description
Procedure Name The name of the stored procedure to open. The Procedure Name box box in the Action Arguments section of the Macro window shows all stored procedure in the current database. This is a required argument.

If you run a macro containing the OpenStoredProcedure action in a library database, Microsoft Access looks for the stored procedure with this name first in the library database, then in the current database.

View The view in which the stored procedure will open. Click Datasheet, Design, or Print Preview in the View box. The default is Datasheet.
Data Mode The data entry mode for the stored procedure. This applies only to stored procedures opened in Datasheet view. Click 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 action is similar to clicking the Run button or Design button in the Database window after selecting a data access page on the Stored Procedures tab.

Switching to Design view while the stored procedure is open removes the Data Mode argument setting for the stored procedure. This setting isn't in effect even if the user returns to Datasheet view.

Tips   You can select a stored procedure in the Database window and drag it to a macro action row. This automatically creates an OpenStoredProcedure action that opens the stored procedure page in Datasheet view.

If you don't want to display the system messages that normally appear when a stored procedure is run (indicating it's a stored procedure and showing how many records will be affected), you can use the SetWarning action to suppress the display of these messages.

To run the OpenStoredProcedure action in Visual Basic, use the OpenView method of the DoCmd object.