Chapter 13. Data Access Pages

When data access pages (DAPs) were introduced in Access 2000, they drew a lot of attention from Access developers who were looking for easy ways to move their data to the Web. DAPs promised to provide an Access-based designer that would allow developers to create web pages based on data, just as forms and reports were. Unfortunately, because of the limitations of the DAP design tools, the often-crippled functionality of the resulting pages (such as the inability to update data), and the requirement that users of the pages must have Office 2000 licenses, DAPs were not widely used.

In Access 2002, DAPs were greatly enhanced. The designer is now on par with Access's form and report designers. Data on pages can be updated under most circumstances, and users without Office XP licenses can legally work with DAPs in the browser, albeit with a limited feature set. However, you'll still need to use Microsoft Internet Explorer 5 and later to view and work with DAPs, and users will still need to have the Office Web Components installed locally.

Perhaps the biggest limitation to DAPs is the way they connect to data. DAPs use ADO recordsets behind the scenes to retrieve and update data. These ADO recordsets are opened on your users' machines, which means that your users must have direct access to the data. The only workaround?using recordsets that are opened on a web server?requires that you set up a complicated technology called Remote Data Services (RDS), which goes beyond the scope of this book. Without RDS, you can't use DAPs to work with data over the Internet, even though you can view the data in a browser.

Still, the Access 2002 implementation has made DAPs a feasible and welcome choice for displaying and editing data, particularly on an intranet (because of the IE and local processing requirements). Database developers may also find that DAPs provide a good starting point in acquiring web database skills.

DAPs are quite different from Access forms and reports. In this chapter, we'll address issues that you are likely to encounter as you begin to use DAPs. Many of these issues involve getting the page to look the way you want it to look. We'll also talk about how you can keep your pages and data properly linked together, and we'll show you how you can use VBScript to add new functionality to your pages.

In order to use any of the existing samples in your own environment, you will need to update the ConnectionString property for each page. Within Access, when you attempt to open the existing pages in the page designer, you'll receive a warning indicating that the connection is invalid. Right-click on the page within the designer, select the Page Properties item from the context menu, and select the Data tab in the Properties window. Select the ConnectionString property, and click the build button (...) to the right of the property. On the Connection page of the Data Link Properties dialog box, browse to the appropriate location of the sample database. The Solutions in Recipe 13-5 and Recipe 13-6 show techniques to avoid this extra step.

DAPs in Access 2002 and Access 2003 are very different from DAPs in Access 2000. Not only did Microsoft greatly enhance the functionality of pages designed in Access, but the designer itself also includes many more features. Therefore, we have not addressed the Access 2000 version of DAPs in this chapter.