About the Series ...
This article continues the series, MS Access for the Business Environment. The primary focus of this series is an examination of business uses for the MS Access relational database management system. The series is designed to provide guidance in the practical application of data and database concepts to meet specific needs in the business world. The majority of the procedures I demonstrate in the series will be undertaken within MS Access 2003, although most of the concepts that we explore in the series will apply to earlier versions of MS Access, as well.
For more information on the series, as well as the hardware / software requirements to prepare for the tutorials we will undertake, please see Tutorial 1: Create a Calculated Field with the Expression Builder. Along with MS Access, of which we have made repeated use in the previous articles of the series, additional application considerations apply for this tutorial, because it introduces another Microsoft RDBMS, MSSQL Server 2000.
For those joining the series at this point because of a desire to work with MSSQL Server 2000 and its components from an MSSQL Server perspective, it is assumed that MSSQL Server 2000 is accessible to / installed on your PC, with the appropriate access rights to the MSSQL Server 2000 environment to parallel the steps of the article. If this is the first time MSSQL Server 2000 is being accessed on your machine, you may need to consult the MSSQL Server 2000 online documentation for installation and configuration instructions.
Introduction to this Tutorial
This article focuses on a topic that in many ways is akin to our last, Extend Access with Pass-Through Queries, in that it is based upon the use of "SQL specific" or "direct SQL" within MS Access. While we have also treated the use of SQL specific queries in other articles, our work with Pass-Through queries in the previous article provides an excellent segue to the use of Stored Procedures within MS Access. The preparation steps of this article will parallel some of the same steps in the last, particularly in the establishment of a data connection. In keeping with my goal of making my articles "standalone," where a reader can perform the steps of the procedures described 1) without having necessarily followed all or part of the series first, and 2) without having to refer to steps in external sources to gain the benefit of an integrated lesson, we will repeat all necessary steps to achieve our objectives from "scratch." My intent is to activate the concepts we introduce within each article through practice examples that are based upon needs that we encounter in the business world, in an end-to-end, complete fashion that allows for "one-stop" exposure to practical subject matter. We will attempt to avoid the broken focus and distraction that come with having to skip about between documents.
Many of us have encountered MS Access in one or more roles in client / server architecture; most of us have been exposed to the use of MS Access as a "front end" to various enterprise-level, back-end databases. As we have mentioned before, MSSQL Server is a natural for the back-end partner in such arrangements, and we can manage communication between MS Access and MSSQL Server in multiple ways. The flexibility of SQL Pass-Through queries, which we discussed at length in Extend Access with Pass-Through Queries, allows us enhanced, efficient communication between MS Access and SQL Server, in that we can use this medium to capitalize upon the use of MSSQL Server-specific SQL to query SQL Server databases with minimal overhead cost at the MS Access level. We will take the pass-through concept one step further in this article and focus on using Access to call Stored Procedures that exist on MSSQL Server, and thereby optimize our interaction with the back-end environment even more.
In this article, we will examine the execution of Stored Procedures from an MS Access client to realize these efficiencies. Our examination of Stored Procedures from an MS Access perspective will include the following:
- A discussion of the nature of Stored Procedures, and instances in which their use can be beneficial;
- A discussion of the advantages that accrue when we leverage Stored Procedures from MS Access;
- Hands-on, practice exercises that include the use of Stored Procedures within MS Access query objects that we create, together with a more involved scenario, in which we create, and then execute, a more substantial Stored Procedure, intended to address a hypothetical business need.