Data Access Page Changes

3 4

Data access pages give you the means of publishing pages on the Web that work with data in Access or SQL Server databases. Data access pages were first introduced in Access 2000, but they weren’t very easy to use. Access 2002 provides many enhancements that make it much easier to create and modify data access pages. In this section, we’ll look briefly at each of these enhancements.

See Chapter 18, "Working with Data Access Pages," for more details on the changes to data access pages.

Data Access Page Designer

When you create a new data access page (or open an existing data access page in Design view), you’ll find a host of improvements and new features, including the following:

  • The Designer now supports multilevel Undo and Redo.
  • Microsoft Internet Explorer 5.5 and 6.0 users have both keyboard and mouse multiselect support for applying sizing, horizontal and vertical spacing, alignment, and property settings to data access pages.
  • Internet Explorer 5.5 and 6.0 users can also see the control’s actual size while they’re resizing it. Snap-to-grid support has been improved, and the Size To Fit command sizes the control to the size of its content.
  • Multiselect drag-and-drop is now available from the field list.
  • Banded (grouped) pages have more functionality, including intuitive drop zones, automatic indenting of group levels, a group-level Properties drop-down option on each group’s shortcut menu, and automatic formatting for caption and footer properties.
  • Banded pages are updatable. You can control updating by using the group-level properties AllowAdditions, AllowDeletions, and AllowEdits.
  • The AutoSum feature makes it easy to create aggregates by selecting a control and clicking AutoSum.
  • Controls, sections, group-level properties, and page properties now have shortcut menus.
  • You can create customized navigation controls by applying the class name of the control to most HTML element types. For example, you can turn a label into a Next navigation control by appending MsoNavNext to the class name of the label.
  • The Layout Wizard now supports Tabular, PivotChart, and Spreadsheet options.
  • You can now bind the Spreadsheet control to data.
  • The Designer now inherits extended properties from both Jet and SQL Server 2000 databases so that lookups are dropped as lookups instead of as static values, and label properties are set appropriately.

Improved Properties Sheet

Data access page properties are now easier to use because of better organization of the properties sheet and several new builders that help you select the appropriate value for a property. You’ll find the following enhancements:

  • Only relevant properties are shown for each element type. Some unneeded properties have been removed, and a richer set of applicable properties are exposed.
  • You can set interior properties of ActiveX controls through the properties sheet.
  • The properties sheet supports builders, including Page Connection, Color Picker, and Zoom.
  • You can turn on a record selector by right-clicking a section, choosing Group Level Properties on the shortcut menu, and then setting the RecordSelector property to True. (The default setting is False, so the record selector isn’t displayed for that group.) The record selector is a vertical band on the left side of the data access page. However, unlike with Access forms, you can’t click the record selector to delete a record from a data access page after selecting it because the Delete Record option on the Edit menu is disabled for data access pages.
  • All pages use alternate row colors by default, but you can change this setting in the Group Level properties sheet.

Deploying Data Access Pages

Access 2002 includes several new features that make it easier to deploy your data access pages on the Web after you’ve designed them, as follows:

  • Access 2000 data access pages will be converted to Access 2002 format when they’re opened in Design view in an Access 2002 database. Solutions created using Access 2000 will still work after you install the new Office Web Components.
  • A page-level script notifies the user with appropriate messages when the correct browser or Office Web Components are not present.
  • Users can set relative paths to Access databases, although only when the page is opened through the file system, not through HTTP.
  • Developers can point all pages in a solution to Office Data Connection (ODC) or Universal Data Link (UDL) files by using the page’s ConnectionFile property. When the page is loaded, it retrieves the connection file and sets the connection specified in the file. Set the default connection for all new pages on the Pages tab of the Options dialog box, by choosing Tools, Options.
  • Developers can set the default pages folder on the Pages tab of the Options dialog box.
  • The page’s link property is exposed both programmatically and in the Page Properties dialog box in the Database window.
  • With the OfflineCDF, OfflineSource, and OfflineType properties, you can build applications that work with SQL Server and Jet replication or XMLdata files. This feature is fully integrated with the Internet Explorer offline synchronization model.

note


See Microsoft FrontPage 2002 Inside Out (Microsoft Press, 2001) for more information about deploying Access data on the Web using Microsoft FrontPage. FrontPage has its own set of tools for this purpose, some of them more powerful than the tools in Access.

Other DAP Improvements

There are a few other miscellaneous changes related to data access pages that make them easier to work with, including a Data Access Page selection in the Save As dialog box for forms, some features that allow you to link to XML documents, and a number of Data Source control attributes.

Working Off Line

You can prepare a data access page for offline work by setting a number of page properties, all available through the object model, or by opening the data access page in Internet Explorer and selecting Make Available Offline in the Add Favorite dialog box. For details on working with data access pages off line, see Chapter 18, "Working with Data Access Pages."

Saving Forms and Reports as Data Access Pages

You can now save forms and reports as data access pages by selecting Data Access Page in the Save As dialog box, as shown in Figure 1-15. Saving a form as a data access page saves a lot of time when you want the page to look just like an existing form. You don’t have to design the data access page from scratch; instead, you can create it from a form you’ve already created.

figure 1-15. you can save a form as a data access page and save the time it takes to design the page from scratch.

Figure 1-15. You can save a form as a data access page and save the time it takes to design the page from scratch.

Creating an XML Data Document

You can create an XML document or XML data island (XML data embedded in HTML code) from a data access page by using the ExportXML method.

Binding Data to an XML Data Document

You can set the properties described in Table 1-4 either on the page’s properties sheet or through code at runtime.

Table 1-4. XML data binding properties

Property Value Description

XMLLocation

dscXMLDataEmbedded

Data appears on the page as a data island.

dscXMLDataFile

Data is an XML data document.

XMLDataTarget

dscXMLDataEmbedded

Sets the ID of the data island.

dscXMLDataFile

Sets the UNC, URL, or absolute path and name of the XML document.

UseXMLData

True

Connection to the live source is dropped and the data access page is bound to the XML source.

Binding to an Arbitrary Recordset

You can now bind data access pages to any arbitrary recordset. Use the SetRootRecordset method to bind to disconnected and persisted recordsets.

New Data Source Control Events

The Data Source control is used behind the scenes to bind data access pages to a data source. Unlike other controls, it has no representation in the interface; you program it in VBA code. This control now has several new events that give you more places to respond to user actions.

Table 1-5 lists the new Data Source control events.

Table 1-5. New Data Source control events

Event Description

AfterDelete

Occurs after a record deletion has been confirmed and the record has actually been deleted, or after the deletion is canceled

AfterInsert

Occurs after a new record is added to the recordset

AfterUpdate

Occurs after a record is updated with changed data or after the record loses focus

BeforeDelete

Occurs before the record is actually deleted

BeforeInsert

Occurs when the first character is entered into a new record, but before the record is actually added to the recordset

Before

Update Occurs before a record is updated with changed data or before the record loses focus

Dirty

Occurs when the contents of a record change, and before the BeforeUpdate event

Focus

Page-level event that occurs when a section receives the focus (as opposed to the Current event, a recordset-level event that occurs when the record changes in the underlying recordset)

RecordExit

Occurs after all update events have fired and before the record loses currency

New Data Source Control Constants

Table 1-6 lists the new Data Source control constants. These constants are used to set the Data Source control properties or are returned by its events, enabling you to take different actions in code depending on what choice a user makes in the interface.

Table 1-6. New Data Source control constants

Constant Description

dscDeleteOK

Indicates that delete operation succeeded

dscDeleteCancel

Indicates that delete operation was canceled through code

dscDeleteUserCancel

Indicates that delete operation was canceled by the user

dscDisplayAlertContinue

Determines whether a custom error message or no error message is displayed

dscDataAlertDisplay

Indicates that standard error dialog box should be displayed

dscRefreshData

Causes the Refresh method to refresh the data cache while maintaining the current connection

New Data Source Control Function

The new EuroConvert function converts a number to euros or from euros to another currency. You can also use this function to convert a number from one currency to another by using the euro as an intermediate value.

Updating Data Access Pages

Banded data access pages are now updatable, and child recordsets are fully updatable, enabling you to add, modify, and delete records from the child recordsets assigned to each band of data.

The Group Level properties sheet allows you to control whether the child recordsets are updatable by setting the following properties:

  • AllowEdits
  • AllowAdditions
  • AllowDeletes

These properties are set to False by default for converted DAPs. DAPs created in the interface have these properties set to True.



Microsoft Access Version 2002 Inside Out
Microsoft Access Version 2002 Inside Out (Inside Out (Microsoft))
ISBN: 0735612838
EAN: 2147483647
Year: 2005
Pages: 172
Authors: Helen Feddema

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net