Microsoft KB Archive/282345

= ACC2002: UseXMLData Property Is Ignored with Offline Data Access Page =

Article ID: 282345

Article Last Modified on 9/27/2006

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



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 &quot;Steps to Reproduce the Behavior&quot; 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  Configure Microsoft SQL Server for replication, and then create a publication on a table that you want to be available for offline use. 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. Add any fields that you want by dragging the fields from the field list to the page. On the View menu, click Properties to open a property sheet. On the Edit menu, click Select Page to ensure that you are viewing the properties of the page.</li> In the property sheet, click the Data tab, and then change the UseXMLData property to True.</li> Change the OfflineType property to dscOfflineMerge.</li> Select the name of the Microsoft SQL Server publication in the OfflinePublication property.</li> Press CTRL+G to open the Immediate window in the Visual Basic Editor.</li>  Type the following line in the Immediate window, and then press ENTER: DataAccessPages(0).MSODSC.ExportXML </li> On the File menu, click Close and Return to Microsoft Access.</li> Save the data access page to a folder on your Web server that can be accessed through HTTP.</li> Close the data access page in Microsoft Access.</li> Start Microsoft Internet Explorer 5 or later.</li> Type the HTTP address of your page to view the page in the browser, for example:

http://MyWebServer/MyFolder/MyPage.htm

</li> Try to edit the page. Note that the page is read-only.</li> On the Favorites menu, click Add to Favorites.</li> Click to select the Make Available Offline check box, and then click OK.</li> After the initial downloading of the subscription is complete, click Work Offline on the File menu.</li> Try to edit the page.</li></ol>

Note that the page is now updateable.

<div class="references_section">