xl Access2002Bible Chapter 35: Using and Creating Access Objects for Intranets and the Internet . . . . . . . . . . . . . . . . . . . . . . 1179 Using the Web Toolbar with Access2002 . . . . . . . . . . . . . . . . . . . 1181 The Web toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1182 Types of Web Pages That Access Can Create . . . . . . . . . . . . . . . . 1184 Data access pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1184 Working with dynamic and static views of Web-based data . . . . . 1185 Exporting Tables, Queries, Forms, and Reports to Web Pages . . . . . . 1189 Exporting an Access table to static HTML format . . . . . . . . . . 1190 Exporting an Access query datasheet to static HTML format . . . . 1192 Exporting an Access form datasheet to static HTML format . . . . 1194 Changing Page Setup properties for datasheets . . . . . . . . . . . 1198 Exporting a datasheet to dynamic HTML format . . . . . . . . . . . 1198 Exporting a form to dynamic HTML format . . . . . . . . . . . . . . 1200 Processing an IDC/HTX file on the Web server . . . . . . . . . . . . 1201 Processing ASP files on the Web server . . . . . . . . . . . . . . . . 1202 Exporting a report to static HTML format . . . . . . . . . . . . . . . 1202 HTML template files . . . . . . . . . . . . . . . . . . . . . . . . . . . 1205 Importing and Linking (Read-Only) HTML Tables and Lists . . . . . . . . 1208 Importing an HTML table . . . . . . . . . . . . . . . . . . . . . . . . 1208 Linking to an HTML table . . . . . . . . . . . . . . . . . . . . . . . . 1210 Using Hyperlinks to Connect Your Application to the Internet . . . . . . 1210 Using the Hyperlink data type . . . . . . . . . . . . . . . . . . . . . . 1211 Adding a hyperlink to a form, report, or datasheet . . . . . . . . . . 1212 Creating a label using the Insert Hyperlink button . . . . . . . . . . 1214 Browsing Web Pages with the Web Browser Control . . . . . . . . . . . . 1215 Chapter 36: Building Web Applications, Data Access Pages, and XML . . . . . . . . . . . . . . . . . . . . . . . 1217 Working with the Data Access Pages . . . . . . . . . . . . . . . . . . . . . 1217 What is a data access page? . . . . . . . . . . . . . . . . . . . . . . . 1218 Creating a single table data access page . . . . . . . . . . . . . . . . 1221 Working with multiple tables and grouped pages . . . . . . . . . . 1230 Changing some key properties on data access pages . . . . . . . . 1244 Saving other Access objects as data access pages . . . . . . . . . . 1255 XML Data and Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1265 Understanding XML . . . . . . . . . . . . . . . . . . . . . . . . . . . 1266 Exporting to XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1267 Importing XML data . . . . . . . . . . . . . . . . . . . . . . . . . . . 1270 3596-X FM.F 5/30/01 11:31 AM Page xl xli Contents Appendix A: Access2002 Specifications . . . . . . . . . . . . . . . . 1273 Appendix B: Mountain Animal Hospital Tables . . . . . . . . . . . . 1279 Appendix C: What’s on the CD-ROM . . . . . . . . . . . . . . . . . . 1287 Appendix D: Chapter Cross-Reference Guide . . . . . . . . . . . . . 1297 Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1305 Coupons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1343 Hungry Minds Inc. End-User License Agreement . . . . . . . . . . . . . 1348 Installation Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1350 3596-X FM.F 5/30/01 11:31 AM Page xli 3596-X FM.F 5/30/01 11:31 AM Page xlii First Things First ✦✦✦✦ In This Part Chapter 1 What Is Access 2002? Chapter 2 Installing and Running Access2002 Chapter 3 A Hands-on Tour of Access2002 Chapter 4 Database Concepts and Design ✦✦✦✦ PART I I 3596-X pt01.F 5/30/01 11:31 AM Page 1 3596-X pt01.F 5/30/01 11:31 AM Page 2 What Is Access 2002? B efore you begin to use a software product, it is impor- tant to understand its capabilities and the types of tasks that it’s designed to perform. Microsoft Access2002 (also known simply as Access) is a multifaceted product; its uses are bounded only by your imagination. Access Is . . . Essentially, Access is a database management system (DBMS). Like other products in this category, Access stores and retrieves information (often referred to as data), presents requested information, and automates repetitive tasks (such as maintaining accounts payable or a personnel system, and performing inventory control and scheduling). With Access you can create easy-to-use input forms like the one shown in Figure 1-1. You can display your information in any way that you want and run powerful reports. Access is also a powerful Windows database application — probably the best end-user/developer product ever written. Microsoft Access brings the productivity of database manage- ment to the usability and consistency of Microsoft Windows. Because both Windows and Access are from Microsoft, the two products work very well together. Access runs on the Windows 95, Windows 98, Windows ME, Windows 2000, or Windows NT platforms, so all the advantages of Windows are available in Access. You can cut, copy, and paste data from any Windows application to and from Access. You can also create a form design in Access and paste it into the report designer. 1 1 CHAPTER ✦✦✦✦ In This Chapter Examining what Access is Looking at some of the capabilities of Access Working with Access if you are already a database user Working with Access if you are already a spreadsheet user ✦✦✦✦ 3596-X ch01.F 5/30/01 11:31 AM Page 3 4 Part I ✦ First Things First Figure 1-1: A typical Access data-entry form Using OLE (Object Linking and Embedding) objects in Windows and Microsoft Office products (Excel, Word, PowerPoint, and Outlook), you can extend Access’s ability to incorporate viewable objects of these Microsoft products — without the need to copy their contents and paste them into Access. This ability enables you to work with the actual data already included in these products without the need to duplicate the information. By using OLE, you can actually change the information in the underlying form object (Excel, Word, etc.). With the Internet extensions in Access, you can create forms that interact with data directly from the World Wide Web and then translate your forms directly into data access pages for corporate intranets that work directly with your Internet browser. The data access pages feature of Access2002 enables you to create browser- based forms to view and edit live data on a corporate intranet or across the Internet. In Access 2000, data access pages only work with Microsoft Internet Explorer 5.0. In version 2002, however, data access pages work with any browser that supports XML 1.1 — including Netscape Navigator 6.x. Browsers that don’t support this standard include older versions of Netscape (4.x or earlier) or Internet Explorer (3.x or earlier). Access is more than just a local database manager. As a relational database man- ager, it allows users to access information from more than one database table at a time — even linking database tables to create a new table. It can reduce the com- plexity of your data and make your job easier to finish. You can connect your Access tables with mainframe or server data — you can even use a table created in dBASE or Excel. You can easily combine the results of the link with an Excel worksheet. Note 3596-X ch01.F 5/30/01 11:31 AM Page 4 5 Chapter 1 ✦ What Is Access 2002? Access’s ability to link to outside data (stored in other database formats) makes it a very robust program. Access can be used in a network environment to connect to a wide range of tables from other databases — both locally (on the same machine) and remotely (even to a mainframe computer’s database, such as Oracle or DB2). Access can link directly to these “outside” tables or import them for local use. Once outside tables are linked or imported, you can create forms and reports to work with the information — to make changes or to view or print the information for later use. Figure 1-2 shows the original Microsoft marketing concept for Access. This simple figure conveys the message that Access is usable at all levels. Figure 1-2: The Access usability hierarchy OBJECTS, TABLES, QUERIES, FORMS. REPORTS FUNCTIONS/EXPRESSIONS MACROS VBA API 3596-X ch01.F 5/30/01 11:31 AM Page 5 6 Part I ✦ First Things First Beginning at the lowest level of the hierarchy and moving up, you see objects listed first; these give the end user the capability of creating tables, queries, forms, and reports easily. You can perform simple processing by using expressions to validate data, enforce a business rule, or simply display a number with a currency symbol. Following the chart, you see that you can use the built-in macros to perform rela- tively complex tasks without the need for creating a formal program. However, Access also lets you build professional quality programs by using VBA (Visual Basic for Applications), which is a code written by the programmer/devel- oper to let the database perform complex processes repetitively. Finally, by using Windows API (Application Programming Interface) calls to functions or DLLs (Dynamic Link Libraries) written in other languages, such as C, Java, or Visual Basic, a programmer can write interfaces to other programs and data sources — using the existing functions built into Windows or other applications. Access has a complete set of tools for end-user database management. Access has a table creator, a form designer, a query manager, a Data Access Page Creator, and a Report Writer. Access also offers a powerful environment for developing complete database applications. As Figure 1-2 points out, you can use macros or modules to automate tasks and create user-oriented applications as powerful as the applica- tions created with programming languages — complete with buttons, menus, and dialog boxes, as shown in Figure 1-3. By programming in Visual Basic for Applications, you can create programs as powerful as Access itself. In fact, many of the tools in Access (such as Wizards and Builders) are written in VBA. The power and usability of Access make it, by far, the best database management software on the market. Figure 1-3: A macro switchboard Simply telling you about what Access can do, however, doesn’t begin to cover the material in this book. In the first 500 pages, you learn to use Access from an end user’s point of view. In the next 500 pages, you learn to use Access from the power 3596-X ch01.F 5/30/01 11:31 AM Page 6 7 Chapter 1 ✦ What Is Access 2002? user’s point of view. In the remaining pages, you learn the basics of VBA, the Internet, and the client/server. This book offers you the ability to examine many topics to a depth that your reference manuals can only begin to touch. What Access Offers The following sections briefly describe some of Access’s key features and prepare you for some of the subjects covered in this book. True relational database management Access provides a true relational database management system. It allows you to build a system consisting of multiple tables that you store in a single container. After these tables are created, they can be linked together to display information from several tables in a single common view. This simply means that when you create and store your information you aren’t required to duplicate information in a single table. For instance, you may need a birthday and Christmas card table that contains the names of all the people that you send cards each year. You may only send birthday cards to some people and you may only send Christmas cards to others. You may also want to track gifts that you send. You can create a single table with a lot of fields for each person — for instance, his or her name and address, whether you sent a birthday card or Christmas gift, and what type of gift you sent. You would probably have to create one table with up to 25 fields in each record, or you can create two tables — one for personal information and the other for the card and gift information. The first example — one single table — is prone to all sorts of problems. For exam- ple, each year you have to re-enter the names and addresses of the people you sent gifts and cards to (thus, you have a lot of duplicate information about their names and addresses, which is prone to error). In addition, you may be tempted to add even more fields to the single table — card2 field or gift2 field, for example — mak- ing it even larger and more prone to error. The second method of employing two tables is more efficient. The first table can contain all of the person’s personal infor- mation; and the second table can include many records for each person about the gifts and cards sent. These two tables can then be linked together using a common field that allows you to display information from both tables. Database design is covered more in-depth in Chapters 4 and 6. As we pointed out earlier in this chapter, Access is a true relational database manage- ment system and includes the ability to define primary and foreign keys that support full referential integrity at the database engine level (which prevents inconsistent updates or deletions). In addition, tables in Access have data-validation rules to pre- vent entry of inaccurate data, regardless of how data is entered, and every field in a Cross- Reference 3596-X ch01.F 5/30/01 11:31 AM Page 7 . This Part Chapter 1 What Is Access 2002? Chapter 2 Installing and Running Access 2002 Chapter 3 A Hands-on Tour of Access 2002 Chapter 4 Database Concepts. Microsoft Access 2002 (also known simply as Access) is a multifaceted product; its uses are bounded only by your imagination. Access Is . . . Essentially, Access