Chapter 10. Working with Pages and Modules

Working with Pages and Modules

Chapter 10 at a Glance

In this chapter you will learn how to:

  • Create static Web pages.

  • Explore Visual Basic for Applications (VBA).

  • Use VBA to create a Web page.

  • Create a data access page with AutoPage.

  • Create a data access page using the Page Wizard.

  • Allow others to analyze data on the Web.

The World Wide Web is the largest public clearinghouse of information in the world. It has become the place to publish and distribute books, software, and data of all types. If your organization has an Internet presence, you will want to take advantage of features in Microsoft Office Access 2003 that can be used to publish your database information so that it is accessible through an intranet or the Internet.

Important

This discussion assumes that you are already familiar with the Internet, Internet service providers, and methods of placing HTML pages on a Web site for publication. If this is not the case, you should still be able to follow along and work through the exercises, but you might need help moving your files to the Web. A good source of information about creating and publishing a Web site is Microsoft Office FrontPage 2003 Step by Step (Microsoft Press, 2003).

Information on the Web is viewed with a Web browser. The two most popular Web browsers are Microsoft Internet Explorer and Netscape Navigator; however, both of these browsers are available in many versions, and other browsers are also available. All browsers are capable of viewing files based on a simple set of Hypertext Markup Language (HTML) tags. Newer versions of the popular browsers also recognize non-standard HTML tags and other file formats, such as Dynamic Hypertext Markup Language (DHTML) and Extensible Markup Language (XML).

Important

If you intend to place database information on the Web, give careful thought to what operating system and browser will be used by people viewing your site. If you would like your site to be available to the general public, then you will have to forgo cutting-edge technology, such as data access pages, in favor of static Web pages or Active Server Pages (ASP).

You can use Access to create two types of Web pages:

  • Static HTML pages, which provide a snapshot of some portion of the database contents at one point in time. These pages can be viewed by any modern browser and can be stored on a server running any server software.

  • Dynamic Web pages, which are created in response to some action on the part of each user.

There are two main types of dynamic Web pages:

  • Data access pages, with which users can directly manipulate data in your database. Users can add, edit, and delete records, and change their view of the data, in much the same way as they would in a form. To take full advantage of data access pages, users must be running Internet Explorer version 5.0 or later.

  • Active Server Pages, which are stored on a network server and generate different views of the data in response to choices users make on a Web page. The pages can be viewed with any modern browser, but the server where the pages are stored must be running Microsoft Windows NT 4, Microsoft Windows 2000, or Microsoft Windows XP. Although Access can export a form or report as an Active Server Page, you will not do that in this chapter. Search for ASP in Access online Help for more information.

In this chapter, you will create static and dynamic Web pages. You will get an overview of Microsoft Visual Basic for Applications (VBA) and see how VBA procedures stored in Access modules can be used to create Web pages. You will also add controls to data access pages to allow other people to view your data, add and edit records, make projections, and analyze your data. You will be working with the GardenCo database files and several other sample files provided on the book’s companion CD.

See Also

Do you need only a quick refresher on the topics in this chapter? See the Quick Reference entries in Chapter 10 Working with Pages and Modules.

Important

Important

Before you can use the practice files in this chapter, you need to install them from the book’s companion CD to their default location. See "Using the Book’s CD-ROM" for more information.

Creating Static Web Pages

The most basic form of an HTML page is a static page. If you want any Web browser that supports HTML 3.2 or later to be able to view your data, you should display the data in static HTML pages. Static pages are downloaded and displayed in their entirety; the user can’t edit them, and there are no tricky bits that pop up or change format as the user moves through the page.

Access can export tables, queries, forms, and reports as static HTML pages. Exported tables, queries, and forms are displayed in datasheet format. (If you have a lot of data, the Web page might be very long.) Exported reports are displayed on a series of short pages, similar to reports in Access.

In this exercise, you will export the Alphabetical List of Products report from the GardenCo database to a set of static HTML pages. You must have a printer installed to complete this exercise.

BE SURE TO start Access before beginning this exercise.

USE the GardenCo database in the practice file folder for this topic. This practice file is located in the My DocumentsMicrosoft PressAccess 2003 SBSPgsModsStatic folder and can also be accessed by clicking Start/All Programs/Microsoft Press/Access 2003 Step by Step.

OPEN the GardenCo database and acknowledge the safety warning, if necessary.

  1. On the Objects bar, click Reports.

  2. Open the Alphabetical List of Products report in Print Preview, to see what it looks like.

  3. Close the report.

  4. On the File menu, click Export to display the Export dialog box.

  5. Navigate to the My DocumentsMicrosoft PressAccess 2003 SBSPgsModsStatic folder, in the File name box, type AlphaProd, in the Save as type box, click HTML Documents, select the Autostart check box, and then click Export.

  6. In the HTML Output Options dialog box, make sure the Select a HTML Template check box is cleared, and then click OK.

    Access displays its progress as it exports the report to HTML pages. Because you clicked Autostart, when the export process is complete, the first HTML page opens in your Web browser. (It might appear as a blinking button on the taskbar.)

    Tip

    If you are prompted to install a printer, click OK, and follow the directions.

  7. If you don’t see the HTML page, on the taskbar, click Alphabetical List of Products to display it.

    Tip

    A title appears in the title bar, the data is in the body of the page, and navigation links and a page number have been added at the bottom.

  8. Click Start, and then navigate to the My DocumentsMicrosoft PressAccess 2003 SBSPgsModsStatic folder.

    A file named AlphaProd, which is the first page of the report, and nine more files named AlphaProd2 through AlphaProd12, which are the remaining pages, are listed.

  9. Return to the HTML page, and click the Next hyperlink repeatedly to scroll through the 12 pages of the report.

    Tip

    If you are interested in seeing the HTML code that makes this page look the way it does, you can view it in Internet Explorer by right-clicking the body of the page and clicking View Source. If you are running Netscape Navigator, click View Document Source or View Page Source on the View menu, depending on the version of Netscape you are using.

  10. Close the HTML report.

CLOSE the GardenCo database.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset