Beginning Web Development in Access 2002

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

 

Siew-Moi Khor and Clint Covington
Microsoft Corporation

December 2001

Applies to:
   Microsoft® Access 2002

Summary: This article discusses Web development in Microsoft Access 2002 using data access pages—how data access pages work, and when to use them—as well as ways to take advantage of new features within Access 2002. A sample tutorial walks you through the step-by-step process of building a data access page (14 printed pages).

Contents

Introduction
How Data Access Pages Work
Why Choose Data Access Pages as a Web Development Platform
When to Use Data Access Pages, ASP, or ASP.NET
How to Create a Data Access Page
Feature Highlights and Walkthroughs
Offline
Performance
Conclusion

Introduction

In Microsoft Access 2002, Web development is greatly simplified. When you develop Web-based applications in Access, you are building Web pages called data access pages.

Data access pages are rich HTML-based documents with Microsoft® ActiveX® controls that can bind to Microsoft SQL Server™, Microsoft Jet, and Microsoft Project data. The ActiveX controls manage the linking, sorting and grouping of data, using ActiveX Data Objects (ADO) to fetch recordsets.

To browse data access pages, you need Microsoft Internet Explorer 5.0 or greater and the Microsoft Office Web Components. Unlike the situation presented by Microsoft Access 2000, in Microsoft Access 2002 you will be able to build applications with data access pages and deploy them without requiring your users to have a Microsoft Office XP license to view the applications.

Data access pages have a world-class HTML design environment that focuses on data. Data access pages allow the user to interact with their data on the Web. Users would be able to filter, sort, save, undo, delete and other actions you would traditionally expect within Access.

Data access pages are often best used within an intranet, or workgroup application where people work directly with one another, as opposed to an Internet application where thousands and thousands of customers may visit the Web site.

How Data Access Pages Work

If you view a data access page's source, you will see <TEXTAREA>, <SPAN>, and stylesheet elements which are HTML-based controls embedded inside the data access page document. You also have the Office Web Components, specifically the PivotTable®, Chart, and Spreadsheet controls which are a part of the Office Web Components DLLs as shown in Figure 1.

Aa139964.odc_adap01(en-us,office.10).gif

Figure 1. An overview of how data access pages work.

There is also a data source control responsible for setting the Internet Explorer data binding properties like data source and data fields on those controls. Data access pages leverage many powerful features in Internet Explorer, enabling you to have these rich data bound experiences by simply setting properties. Microsoft Windows® data services like ADO and the OLE DB Cursor Engine are used to make the data connection and bring the data down locally.

Data access pages bind to live and XML data sources when browsed. In the run-time environment when you are browsing the pages, there is very little difference between using Internet Explorer 5.5 and Internet Explorer 5.0. However, you will have a better design experience in Internet Explorer 5.5 than Internet Explorer 5.0 as data access pages plug into and take advantage of certain features in Internet Explorer 5.5. For example, you will be able to do multiselect which you can't in Internet Explorer 5.0, which makes a huge difference.

Normally, developers wanting to build Web applications end up having to spend a lot of time writing the code. If you want to do this but don't want to write a lot of code, you might want to leverage the data source and underlying data annotations in Access. For example, to create a Boolean field, all you have to do is just drag that field onto a data access page. A check box will be created for you without you having to write any code. If you want a text box with a lookup field to find, you would want a drop-down list box created for that lookup. To create something like this, again, all you have to do is simply drag a text box onto a data access page.

This is made possible because all of the metadata that Access stores underneath the covers in a database are moved forward and wrapped up in an application environment. This reduces the time developers have to spend setting up a long list of random properties that don't fundamentally change what a developer is trying to do with an application.

For those who are experienced working with forms and reports, you will find the design experience in data access pages intuitive as you leverage familiar toolsets. Although it is not a complete one-to-one mapping, users with this prior knowledge will find data access pages flexible and easy to use.

Why Choose Data Access Pages as a Web Development Platform

In the past, to create Web forms, reports, and data for display on the Internet required a lot of work. A Web developer would need to write a lot of code to build a Web application. Traditionally, a Web developer would not use Access to build an Internet application.
Access 2002 makes it possible for developers to build Web applications without having to spend the development cost of getting data up on the Web. With an improved development environment in Access 2002, it has become even easier and faster for developers to design and develop Web-based solutions. They can do it easily and quickly by dragging and dropping controls.

Data access pages allow you to create and extend solutions that integrate seamlessly with enterprise-wide data sources, specifically SQL Server. However, you could also integrate with other data sources. It provides corporate enterprises and small independent software vendors (ISVs) the ability to get data onto the Web and expose it using standard tools and data access type of techniques.

Access 2002 also has a new feature that allows you to save forms and reports out to XML and XSLT. You can then apply transforms to move your data easily onto the Web.

When to Use Data Access Pages, ASP, or ASP.NET

Advantages of data access pages include:

  • Doesn't require coding
    You can create a data access page without having to write a single line of code. You can drag and drop controls and get things working without having to write code. You can also choose to create data access pages programmatically.

  • Lower development cost
    Since the underlying data sources and data structures are known, a lot of things are done for you automatically. This means you can build applications a lot faster, without having to write the code, as a lot of things will be hooked up automatically for you. For example, a lot of properties, ADO, and SQL statements are generated for you.

  • Rich client experience with run-time features (filtering, sorting, saving, undo, deleting)
    When you work with active server pages (ASP), you are predominantly bringing in a lot of disconnected recordsets. If you want to do anything with the disconnected recordsets, you have to make a trip back to the server. With ASP.NET, you do not have to make as many trips back to the server, but ASP.NET still does not reach the level of interactions and rich client experience that data access pages provide. When you talk about rich client experience, data access pages allows you to filter, sort, save, undo, and delete – those type of standard recordset manipulations that users appreciate being able to do.

  • Rich integration and interaction experience with the Office XP Web Components
    This allows you to bring the PivotTable list in and some properties are automatically set out for you so you can do filtering immediately. There is also the PivotChart view that you can leverage and the spreadsheet component which you can bind to and write formula on the dataset.

  • **Easier to do groupings and totals
    **With data access pages you can easily do groupings and totals which will also allow you to drill into the details, without having to write the code to make it happen.

  • **Efficient offline pages
    **For users who need to work offline or are road warriors, you will be able to use the SQL Server merge publication by means of Synchronization Manager to use the application offline. The data will be replicated for you. If you are looking for read-only data, you don't need to have SQL Server running on the machine as you can use XML instead. Therefore, it is important to consider the sort of environment your customers will be interacting with the solution before you start building an application.

    When you think of data access pages, think of departmental or workgroup applications where the data may be in a SQL Server, Access databases or an enterprise database with 20, 50, 100, or 300 people accessing it as opposed to a SQL Server and an ASP server where you have thousands and thousands of customers or vendors hitting the Web site consistently.

Advantages of ASP.NET include:

  • **Allows a middle tier layer
    **ASP.NET is a great solution that scales to an enterprise's needs. When you talk about disconnected recordsets, you are talking about just opening the database and then closing it again as soon as you have obtained your data. In distributed applications, ASP.NET has really done a great job, allowing you to maintain your business logic in the middle-tier layer. Data access pages do not really have this middle-tier layer for business objects outside of SQL Server stored procedures. If you are looking to build applications where you are going to have a very rich large set of middle-tier business objects, even though you can do it in script in data access pages, it is still best to keep them in the managed code space where you have the ability to scale.

  • Works with any browser
    ASP.NET can be made to work with any browser. If you can't require your user to have Internet Explorer 5.0 or later and Office XP Web Components, then you ought to think about using ASP.NET instead.

  • **Ability to scale
    **ASP.NET allows you to scale easily to meet an enterprise's changing needs.

  • **Disconnected recordsets don't hold open active connections
    **Data access pages keep an active connection of a database. When you browse a data access page, the active connection remains open unless you write some code for it to persist a disconnected recordset. Otherwise, it is an active connection going directly against your database. In ASP.NET it is all disconnected and there is also a smaller server licensing requirement for ASP.NET applications.

  • **Native support for other data sources
    **ASP.NET also has native support for just about any data source which data access pages don't.

    When you think of ASP.NET, think of enterprise-wide types of applications where you have thousands of people hitting the Web site. If you think of small departmental-wide applications, data access pages provide you with a very interesting toolset which you could even use inside of an ASP.NET application, depending on the type of usage.

How to Create a Data Access Page

In this sample tutorial, you will be shown how to create a data access page without writing any code. You will be pleasantly surprised at how easy and how fast it is. Someone who already knows how to create data access pages would be able to build this sample quickly.

Data access pages have three key views:

  • Design View,as its name suggests, is where you design the look and feel of the data access page you want to create. It is also where all the objects within a data access page are revealed. These objects are controls. You will find many of these controls very similar to those for forms and reports if you are familiar with form and report creation. You can switch a data access page to Design View from Page View by clicking View, then Design View.
  • Page View shows the data on the data access page allowing you to navigate through the records. You can also open a data access page in a browser by clicking on the data access page file or pointing the browser at the URL where the standalone data access page resides. You can switch a data access page to Page View from Design View by clicking View, then Page View.
  • Web Page Preview opens a browser session as a container for your data access page, showing you how the data access page would look like when posted on the Web.
  1. Start Access. Click Help, point to Sample Databases, and then click Northwind Sample Database.

    Note    If you haven't installed the Northwind.mdb sample database, you need to do that first. If you do not have the Northwind Sample Database installed, you will be prompted at the end of step 1 and asked if you want to have it installed. If you click Yes, you will be guided through the installation process.

  2. On the Main Switchboard form, click Display Database Window.

  3. In the Database Window, on the Objects tab, click Pages, then double-click Create data access page in Design view.

  4. In the Field List pane, expand the Orders table to display all the fields under Orders.

  5. Select the first seven fields (OrderID to ShipVia) at the same time. To do this, click OrderID. Hold down SHIFT and click ShipVia.

  6. Drag the highlighted fields to the left side of data access page. See Figure 2 to check that you have placed the fields correctly.

    Note    If you make a mistake, click Edit and then Undo Create.

  7. Select the last six fields, ShipName to ShipCountry. Add them to the data access page by dragging them to the right side of the page. Compare your results with Figure 2.

  8. Drag the OrderDate field to the section just above the Header: Orders bar. You will see a blue Create new section above Orders bar indicated in this area as you drag the OrderDate field to that area. This action creates a new header called Header: Orders-OrderDate.

  9. Click Header: Orders-OrderDate to display the list.

  10. Right-click and click Group Level Properties to display the GroupLevel: Orders-OrderDate dialog box.

  11. Click on the GroupOn property value. This will display a drop-down list box. Select the dscYear value to group the orders by year. Close the dialog box.

  12. Set a query. To do this, go to the Field List pane. Expand the Queries folder. Click Order Details Extended.

    **Note   ** Before dragging the Order Details Extended field onto the data access page, make sure the Control Wizards tool on the toolbox is pushed in. If it is, Access will display the Layout Wizard when you drag a field onto a data access page. It will ask whether you want to add fields as individual controls (in columnar or tabular layout) or as a Web control (Microsoft Office PivotTable Component, Spreadsheet Component, or Chart Component). Otherwise, you will get the default layout which is columnar. To display the Toolbox, click View, point to Toolbars, then click Toolbox.

  13. Drag the Order Details Extended field to the area just above the Navigation: Orders bar. You will see a blue Create new section below Orders bar indicated in this area as you drag the Order Details Extended field to that area.

  14. When the Layout Wizard dialog box is displayed, click Tabular, then OK. This displays the Relationship Wizard dialog box.

  15. Click OK. This creates a tabular Order Details Extended table.

  16. Next, highlight the Extended Price field column which is located right at the end of the Order Details Extended table you just created by selecting it. This will enable the AutoSum button (the icon for this button is in the sign of sigma) on the toolbar.

  17. Click the arrow on the AutoSum button, and click Sum. This gives you the sum of your orders which is the Sum of ExtendedPrice field. This appears on the Orders section.

  18. Click the arrow on the AutoSum button again and click Sum to give you the sum of your order details which is the Sum of SumOfExtendedPrice field. This will appear in the OrderDate section.

    Click here for larger image

    Figure 2. Design view of the sample up to step 18 (click for larger image).

  19. Double-click on the Header: Order Details Extended header bar. This displays the Section: HeaderOrderDetailsExtended dialog box. Click the Data tab.

  20. Set the Unique Table property to Order Details. ADO can only update one table at a time, so you need to select a table to tell it which to update which in this example is Order Details.

  21. Close the dialog box, click View, and then click Page View.

Now you are done. You have just created a data access page with order dates for 1996, 1997 and 1998 and all the different totals as shown in the Sum of SumOfExtendedPrice field. Expand the Order Date node to view the details. To view even more details, expand the Order ID node. Filter, sort, delete by clicking the relevant icons on the toolbars. To return to the design view just click View and point to Design View. You could also view this using the browser. Just click File, then Web Page Preview.

As you can see, although this type of application might not scale to an enterprise-wide solution, if you want to get data on a corporate network or build small work group type of applications and don't want to spend a lot of money and resources, this is the kind of solution that would work really well for you and your customers.

Feature Highlights and Walkthroughs

Let's take a step back and walk through some interesting new features which you can take advantage of in Access 2002.

Field List, Data Outline and Binding to Images

Field List

The Field List enumerates all the tables and objects that are in your database. The example above went against a Jet database but you could as easily bind to data from a SQL Server. A lot of the work has been done in Access 2002 to take advantage of the extended properties in Microsoft SQL Server 2000.

From the Employees table, drag the EmployeeID and Reports To fields onto a new data access page. You will find the EmployeeID caption label has a space in it. This is because internally in the database, Access 2002 has defined a caption property for you automatically. For the Reports To field, a lookup has been set up in the column.

Data Outline

On the toolbar, click Data Outline (or alternatively, click View, then Data Outline) to display its dialog box. As you can see, Access 2002 has generated the syntax that brings in two recordsets by setting up the join between the employee's Name and the Reports To field.

You can liken this to a query design environment. Traditionally for Access forms or reports, you have to first design your own query before dragging in the fields from the Field List. Now in data access pages, you don't have to go into the query builder to create that kind of query unless you have something very specific that you want to build.

Binding to Images

In data access pages, you can bind directly to images. To display images on a Web page, just set up the URLs to where the images are stored relative to the data access page as shown in Figure 3. Note that you won't be able to use the OLE link objects. (In the Database Window, on the Objects tab, click Tables, then double-click Employees. This will display the Employees: Table table. Scroll horizontally to the Photo field.)

Aa139964.odc_adap03(en-us,office.10).gif

Figure 3. Storing images in the database.

To bind an Image control to the data stored in a table, create a text field column in a table which contains the paths to where the images to be displayed are stored. Unless a full path to the images is specified, the data access page will look for the images in the same folder as the page itself.

Once you have done that, to add the image to your data access page, first enable the Image control on the toolbox. Next from the Employees table, drag the Photo field onto the data access page. Resize to make the image size bigger. Click Page View. Scroll through the records by clicking the navigation control to view the different photos.

Creating Group Reports, Drop Zone, Joins, Layout Wizard and Group Level Properties

Creating Group Reports

You have the ability to create group levels in reports, where you can group on values and show the details of each item.

From the Field List, double click on the OrderID field to place it on a new data access page or alternatively drag it onto a page. Repeat this for CustomerID and EmployeeID fields.

Drag OrderDate to the section just above the Header: Orders bar. You will see a blue Create new section above Orders bar indicated as you drag OrderDate to that area. This area is called a drop zone. This action creates a new header called Header: Orders-OrderDate. What you have just done is created a new group level.

Usually, when you drag a field from the same table to the section above, most of the time you want to group on that field. There are times you might like to do a join, for example when you have a sublist of Reports To. Here you would want to show the people working underneath that person. What you do then is drag the Reports To field and the control underneath it. But when you want to group on a value, you just select from the same table and drag it to the section above and a grouping definition is automatically created for you.

The Data Outline dialog box (to display, on the toolbar, click on the Data Outline icon, or alternatively, click View, then click Data Outline) shows you what the grouping and recordset definitions are. It also gives you the names of those fields.

In this example, you have created a group on OrderDate by dragging to the section just above the Header: Orders bar. Another way to do this is by dragging the OrderDate field onto the same section as the rest and then promoting it by clicking the Promote button.

Joins

Access will automatically create a join for you if you select the fields from two related tables and place them onto the page. However, if you have a field from another table, for example EmployeeID, which means you have two joins, then you want to promote the field from the page itself which will create the grouping.

Layout Wizard

When you drop a field onto the data access page and if the Control Wizards button on the Toolbox is pushed in, Access will display the Layout Wizard which allows you to choose the types of layout you want. As an example, drag the OrderDetails table onto the section below the Order section after first enabling the Control Wizards tool.

Group Levels Properties

The sorting and grouping dialog box is gone in Access 2002. To set the group on and group interval properties that you traditionally go into the dialog box to set, this is how you do it. On the header bar, click on the arrow to display a drop down list box. Click Group Level Properties. Alternatively, you can right-click and click Group Level Properties.

For this example, this displays the GroupLevel: Orders-OrderDate properties dialog box detailing the group level properties settings as shown in Figure 4.

 Click here for larger image

Figure 4. Group Level Properties dialog box (click for larger image).

Each of these properties you can set specific to that particular section. To allow or prevent anyone from editing your order data, set the AllowAdditions, AllowDeletions and AllowEdits properties as appropriate. These are all new property additions in Access 2002.

Another interesting property is the AlternateRowColor property where you can set the color for alternate rows from the many color choices available. This is a very useful property as it makes analyzing rows and rows of data easier on the eyes especially if there are many tabulated fields.

The ExpandByDefault property, if set to True, will display all the data contained within the page when open. If set to False, it is collapsed by default.

Setting the RecordNavigation and RecordSelector properties to True will create an arrow indicator showing which recordset has currently been selected. Try this by setting them to True, save your data access page, and click Web Page Preview.

The GroupOn property is where you set what you want to group on for each value. This being a date, you have been offered the date-related types of solutions.

Group Filter Control

The Group Filter Control is a very useful control in data access pages. Double-click on each field from OrderID to ShipVia fields to populate a new design page. Alternatively, highlight these fields all at once and drag them onto the data access page. Right-click on the edit box of the ShipVia field on your design page and click Group Filter Control. Browse the page (either using Page View (click View, then Page View), or click File and point to Web Page Preview). Notice that there is no data. Click on the drop-down list box of the ShipVia field and make a selection from the list. Note that the other fields are automatically populated with the relevant data. This allows you to show the different properties that you want on that field.

When you use the group filter control, it is good designing practice to make that particular field you are group filtering on as the caption, as shown in Figure 5. Create this caption section by clicking on the Headers: Orders drop down list and create a Caption section. This makes it more intuitive for users to use. That's the only bound control that you can place on the caption section. For all the others, you have to use the header section.

Aa139964.odc_adap05(en-us,office.10).gif

Figure 5. Captioning a group filter control field.

The header section is very similar to the details section in Access forms. To change how many records to be displayed in each section, first display the Group Level Properties for the Orders header. The DataPageSize property allows you to set the number of records you want displayed at one time. For example, if you set it to 5, five sets of records will be displayed. Try this by selecting 5, saving the page and then browse using Page View. Make a selection from the Ship Via drop-down list box and you will find five sets of records displayed in that one page.

PivotTable and Spreadsheet Controls

PivotTable Control

Place the OrderID to ShipVia fields onto a new data access page. Add the Freight to ShipCountry onto the page. Add the Order Details table below the bottom the Orders section. When asked by the Layout Wizard dialog box how you want the Order Details laid out, click PivotTable. Click View and then Page View. Scroll through the orders by clicking the scroll control.

As you can see, there is rich Web component integration. Without having to write the code, your PivotTable form could now filter through the recordset based on the relationship. For the Northwind database, how the Orders and Order Details are related have already been defined. If relationship were not already defined, then the designer will launch the Relationship Wizard that will ask how you want to relate the two tables.

Spreadsheet Control

Drag and drop OrderID and CustomerID fields to the page. Drag the Order Details table and drop it below the CustomerID field and make it into an Office Spreadsheet layout when prompted by the Layout Wizard dialog box (make sure the Control Wizards tool on the toolbox is enabled first). On the Sheet tab of the newly created spreadsheet, click Sheet 2. On cell A1 type =sum(sheet1!unitprice) because you are currently in Sheet 2 and the recordset is in Sheet 1.

Save the page and click View, then Page Preview. You can see as you navigate through the page, all the unit price fields have been summed up for you. You can view the individual details by viewing Sheet 1.

If you have a query for extended price, you could use this to do your sum of orders. Those who are familiar with Microsoft Excel will find this particularly useful as they can build models just based on the record levels and find it easy for them to build it right into their data access pages. You could also write code that will set this to a hidden and pull the values out and display them in HTML fields. This makes it easy for you to do Excel calculation in the browser.

Connection File

You can use one connection file that connects to ten pages making it easy for you to move pages from test to live. To do that let's take a step back. Quit Access and then restart it. Next, click File, point to New and then click Blank Data Access Page. This displays the Select Data Source dialog box. Double-click +Connect to New Data Source.odc. This launches the Data Connection Wizard. Select Other/Advanced as instead of SQL Server, you will connect to the Jet database in this example. Click Next.

Select Microsoft Jet 4.0 OLE DB Provider and click Next. In Select or enter a database name, type C:\Program Files\Microsoft Office\Office10\Samples\Northwind.mdb, or alternatively, browse to where the Northwind.mdb resides. Click OK.

This displays the Data Connection Wizard – Choose Data dialog box. Click Next. What this wizard does is ask you how you want to connect up and whether you want to save the password in the file. Click Finish.

At this point what you have done is created an ODC file. If you now create a new blank data access page which displays the Select Data Source dialog box, you will have a default.odc file that you created just awhile ago as one of the selections. It is an XML file with an ADO connection string.

You can just select the default.odc file and choose Use Connection File from the Open drop down list. What this does is Access will then fetch the file to use that particular file connection. This gives you the ability to have all your data access pages looking at the same connection file.

Another way to set this up is by right-clicking on a new data access page and then click Page Properties. In the Data tab of the Page dialog box, there is a new property called ConnectionFile. If you click on it, it will display the same Select Data Source dialog box where you can select the data source which will then bind the page to that file.

Embedding XML

Another interesting thing you can do is embed XML data inside the page or alternatively link the page to an XML file. To do so, create a new data access page and place the OrderID to ShipRegion fields on it. If you browse the page and view the source (right click on the Page view then View Source), you will find XML data inside the file. When the page loads it will get all its data from the internal XML file. However, you won't be able to update this data because it is just XML and there isn't a way to get XML from the page back into the database. Nevertheless it gives you a great read-only way of looking at data.

If you are going to use this feature, use a link file if you have data over 100 records. This is because as the browser loads, it has to parse through all the XML file using just the native browser. Parsing this way is much slower than using the Microsoft XML Parser (MSXML). Not only that, after the browser has parsed the file, it then has to turn the file over to MSXML to parse to build the XML hierarchy.

In the Data tab of the Page Properties dialog box, if you set the UseXMLData property to True, set the XMlLocation property to dscXMLDataFile, and set the XMLDataTarget property to "example.xml" when you run the ExportXML method in Visual Basic®, it will export the data to that file. All you have to do is go into the Visual Basic Editor (click Tools, point to Macro, and then click Visual Basic Editor) and in the Immediate Window, type dataaccesspage(0).msodsc.exportxml. This allows your pages to bind to read-only XML.

You can write your own navigation control and customize the look and feel of it. To do this, first place some fields from the Orders table onto a new data access page. Enable the Label control on the toolbox and add a label to the page. Type Next in the label. Double-click on the control that you want your custom control to simulate, which is the forward record navigation control in this example. This displays the Image: OrdersNavNext dialog box. Copy the ClassName property in the Other tab menu. The class name in this case would be MsoNavNext.

**Note   **If you have problems displaying the Image: OrdersNavNext dialog box, set the record navigation control all the way to the beginning first. Then try double-clicking on the forward record navigation control again.

Click the Next label you created earlier to display the Label: Label0 dialog box. Click the Other tab. Append MsoNavNext to this label's class name.

**Note   **Make sure there is a space between the class names when you append.

For this example, set the Cursor property for the label to a hand. Browse the page in Page View. Click the Next control you just created and notice that it has become a custom navigation control.

If performance is a concern for you, convert your controls to either bound span controls, or create your own images. There is a little performance lag in swapping out all these images as all the images are loaded inside the Office Web Components DLL, and Access has to make sure that all the states are maintained. You will get good performance improvements by creating your own either text or image controls and setting the source attribute.

Create Your Own Images

To create your own image for this example, return to Design View and enable the Image control. Set the record navigation control all the way to the beginning. Then double-click on the forward control to display the Image: OrdersNavNext dialog box. Click the Other tab to change the Src attribute (source attribute). At the moment it is owc://GIF/#11204. Set it to point to an image you have created. Access will automatically use that when your page is browsed.

Server Filter

On the toolbar, click Data Outline (or alternatively, click View, then Data Outline) to display its dialog box. Right-click on Orders and then click Properties to display the RecordsetDef: Order dialog box. You can set your own recordset properties. For example, you want to bring down only one order—an order with the OrderID 10553. To do this, in ServerFilter property edit box, type orderid LIKE 10553. When you browse this page, there is only one order displayed as can be seen on the navigation bar. This order would have OrderID 10553.

The ServerFilter is just a WHERE clause. That's a big performance win if you just want to pull down just a subset of data, as that's the only data that will be pull down from the server.

MultiSelecting, Undoing and Redoing

Multiselect

If you have Internet Explorer 5.5 installed, while in design view, you will be able to multiselect the controls, move them around the page, or resize them. Or, with these fields multiselected, if you click Format, you can choose from the list of formatting choices available like Horizontal Spacing, Size To Fit and so on so forth—all the features available in Access forms and reports that make it easy to get control exactly where you want.

Undo and Redo

You have the ability to undo up to 20 of your most recent actions. However, the undo stack is cleared if you browse the page, that is, if you switch from Design View to Page View. If you want to see how a page looks like in a browser without losing the undo stack, use Web Page Preview to view your page instead.

Offline

If you want to make a data access page available offline, in the Page Properties dialog box, set the OfflineType property to dscOfflineXMLDataFile.

What happens is if you add the page to your Favorites property when browsing the data access page, a copy of the data is replicated to your local Internet Explorer cache as an XML file, and the page connection string is changed to look at this XML file instead. This gives you the ability, for example, to have your sales people have sales information that is always available to them offline and there is no code involved in enabling them to do so.

However, it is important that you know your data well before you allow people to do that, because if you have a million rows of data it is better not to have it available offline, as it won't work out as well using an XML file.

Performance

The following are some of the ways you can improve performance:

  • Use the Data Outline object's ServerFilter property when possible, as this way only the needed data is pulled down and displayed.
  • Use bound span controls instead of text boxes as they are lighter weight, since they display the contents of a text field but with editing disabled. As such, the browser doesn't have to track if a user is typing anything in.
  • Use custom images or labels for navigation controls.
  • Limit aggregates when possible. Since a calculated field computes a result across multiple rows, more data has to be brought down and more calculation required, thus reducing performance.
  • For XML files, use a link file instead of an embedded file, as embedded XML causes extra parsing.

Conclusion

Access 2002 contains many interesting and useful features that make Web application development a simple and intuitive process. Data access pages, which can be built programmatically, allow you to construct your Web applications quickly and easily.

For more information about data access pages as well as a useful reference list to related topics, see Paul Cornell's article Working With Data Access Pages.