Share this Page URL
Help

Chapter 14.  Working with SQL Server Data - Pg. 639

CHAPTER 14 Working with SQL Server Data Microsoft has always made it easy to connect to SQL Server data from Access by al- lowing you to create linked tables using Open Database Connectivity (ODBC). You have also been able to create pass-through queries in Access that use ODBC to send commands to SQL Server for processing. In Access 2000, Microsoft introduced a new way of using Access to work with SQL Server. Instead of creating regular MDB databases and using ODBC, you could create a new kind of application called an Access Data Project (ADP). ADPs don't use the Jet database engine and ODBC; instead, they use an OLE DB connection to a SQL Server database. In ADPs, you have the ability to view and modify SQL Server objects, and you can create forms, reports, and data access pages based on your SQL Server data. In this chapter, we present a range of tips for using both traditional MDBs and the new ADPs to create Access applications that read and manipulate data stored in a SQL Server database. 14.1 Dynamically Link SQL Server Tables at Runtime Problem Your Access SQL Server database uses linked tables and views in SQL Server. You have set up security and permissions in SQL Server and want to make sure that each user's linked tables are attached under their own permissions, not another user's permissions. In addition, you don't want the users to be prompted for an additional login ID and password each time they use a table. Solution If you link SQL Server tables from an Access database using the File Get External Data menu commands, you will be prompted to use or create a Data Source Name (DSN). The main drawback to DSNs is that they need to be installed on every user's machine. A better solution is to use VBA code to link or relink tables. You can supply connection information in the Connection string without having to create a DSN. 639