Executing Stored Procedures

You can execute stored procedures using a pass-through query or using ADO code. The code that follows provides an example of how you can execute a stored procedure using a pass-through query. It is located in basStoredProcedures.

Sub SPWithPassThrough()
    DoCmd.OpenQuery ("qpassCustomers")
End Sub

This code executes a pass-through query called qpassCustomers that contains the SQL required to execute a stored procedure called procCustomerGetContactTitle. To run, the pass-through query must exist, it must contain a valid connection string, and it must contain SQL that looks something like this:

procCustomerGetContactTitle 'Marketing Manager'

In this example, the pass-through query executes a stored procedure called ...

Get Alison Balter's Mastering Access 2002 Enterprise Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.