ACC2002: UseXMLData Property Is Ignored with Offline Data Access Page (282345)



The information in this article applies to:

  • Microsoft Access 2002

This article was previously published under Q282345
Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies only to a Microsoft Access project (.adp).

SYMPTOMS

When you are working offline with a data access page that is bound to XML, the page is updateable, even though it should be read-only. You may also notice that the UseXMLData property of the DataSourceControl still returns True after the page is offline.

CAUSE

The offline functionality of data access pages takes precedence over the UseXMLData property. As a result, the UseXMLData property of the page is ignored, and the data in the page is updateable.

RESOLUTION

To prevent a user from making updates in the data access page, set the RecordsetType property of the page to dscSnapshot. To set the RecordsetType property, follow these steps:
  1. Start Microsoft Access, and then open your data access page in Design view.
  2. On the View menu, click Properties to open a property sheet.
  3. On the Edit menu, click Select Page to ensure that you are viewing the properties of the page.
  4. In the property sheet, click the Data tab.
  5. Change the RecordsetType property to dscSnapshot.
  6. On the File menu, click Save.
  7. Close the data access page.
Now when you work online or offline with the data access page bound to XML, the page will always be read-only.

STATUS

This behavior is by design.

MORE INFORMATION

You can create a read-only data access page in Microsoft Access by binding the page to XML and setting the UseXMLData property of the page to True. This causes the page to be bound to static, read-only data from the database. You can take a data access page that is bound to XML and work with it offline, for example, to look up information or to do ad hoc reporting.

You can also bind data access pages to a SQL Server database running locally on the Microsoft SQL Server Desktop Engine. Data access pages bound to SQL Server databases running locally can also be taken offline. However, in this scenario, the data is updateable and you can synchronize the local subscription to the publication on a central Microsoft SQL Server.

NOTE: When you bring the page back online, the XML data is not automatically refreshed. To refresh the XML data, you must call the ExportXML method of the Microsoft DataSourceControl (DSC) as outlined in step 10 in the "Steps to Reproduce the Behavior" section later in this article. This creates an external XML file that contains the current data in the database.

Steps to Reproduce the Behavior

NOTE: The following steps assume that you understand how to configure Microsoft SQL Server for replication and how to create a SQL Server publication. Furthermore, in order to work with an offline data access page in Microsoft Internet Explorer, the page must be hosted on a Web server and must be opened by using an HTTP address. This article also assumes that you have a properly configured Web server to host the data access page.

For more information about configuring Microsoft SQL Server 2000 for replication and creating a distributor and publication, please refer to Microsoft SQL Server 2000 Books Online, which is available at the following Microsoft Web site:

http://msdn.microsoft.com/library/default.asp?URL=/library/psdk/sql/portal_7ap1.htm
  1. Configure Microsoft SQL Server for replication, and then create a publication on a table that you want to be available for offline use.
  2. Start Microsoft Access 2002, and then create a blank data access page that is based on the Microsoft SQL Server database that contains the publication.
  3. Add any fields that you want by dragging the fields from the field list to the page.
  4. On the View menu, click Properties to open a property sheet.
  5. On the Edit menu, click Select Page to ensure that you are viewing the properties of the page.
  6. In the property sheet, click the Data tab, and then change the UseXMLData property to True.
  7. Change the OfflineType property to dscOfflineMerge.
  8. Select the name of the Microsoft SQL Server publication in the OfflinePublication property.
  9. Press CTRL+G to open the Immediate window in the Visual Basic Editor.
  10. Type the following line in the Immediate window, and then press ENTER:
    DataAccessPages(0).MSODSC.ExportXML
    					
  11. On the File menu, click Close and Return to Microsoft Access.
  12. Save the data access page to a folder on your Web server that can be accessed through HTTP.
  13. Close the data access page in Microsoft Access.
  14. Start Microsoft Internet Explorer 5 or later.
  15. Type the HTTP address of your page to view the page in the browser, for example:

    http://MyWebServer/MyFolder/MyPage.htm

  16. Try to edit the page. Note that the page is read-only.
  17. On the Favorites menu, click Add to Favorites.
  18. Click to select the Make Available Offline check box, and then click OK.
  19. After the initial downloading of the subscription is complete, click Work Offline on the File menu.
  20. Try to edit the page.
Note that the page is now updateable.

REFERENCES

For more information about working with data access pages offline, click Microsoft Access Help on the Help menu, type about offline data in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Modification Type:MinorLast Reviewed:9/27/2006
Keywords:kbDAP kbprb KB282345