Microsoft KB Archive/284960

= ACC2002: Requery Method Does Not Rebind Page to XML Data File =

Article ID: 284960

Article Last Modified on 11/6/2003

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q284960



Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SYMPTOMS
If you change data in an XML file to which a data access page is bound, requerying the page through script does not show the updated data. You may see this behavior if the page is bound at run time or by using the user interface.



CAUSE
The Requery method does not destroy the XML data that was created on initial binding. As a result, the XML document object model does not fetch the current data.



RESOLUTION
To work around this behavior, use the Refresh method of the Data Source Control, as follows:

MSODSC.Refresh



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



MORE INFORMATION
You can bind a data access page to XML data that is embedded on the page (this is known as an XML data island) or to an external XML file. Binding the page to XML creates a read-only page.

Steps to Reproduce the Behavior
 Open the sample database Northwind.mdb or the sample project NorthwindCS.adp. In the Database window, click Pages, and then click New. In the New Data Access Page dialog box, click AutoPage: Columnar, click the arrow in the Choose the table or query where the object's data comes from box, click Shippers, and then click OK. On the View menu, click Design View. Right-click the page, and then click Page Properties on the shortcut menu.</li>  Set the following properties for the page: <pre class="fixed_text">  UseXMLData: True XMLDataTarget: C:\RequeryTest.xml XMLLocation: dscXMLDataFile </li> Press CTRL+G to open the Immediate window.</li>  Type the following line in the Immediate Window, and then press ENTER: DataAccessPages(0).MSODSC.ExportXML This code creates the XML file that is specified in the XMLDataTarget property and binds the page to the file. </li>  Add a command button to the page, and then set the following properties for the command button: <pre class="fixed_text">  ID: cmdRequery InnerText: Requery </li> On the Tools menu, point to Macro, and then click Microsoft Script Editor.</li> In the Client Objects & Events box, click cmdRequery in the list. Double-click onclick in the list of events.</li>  Enter the following line in the Script Editor between the SCRIPT tags, and then remove the Return line. MSODSC.DataPages(0).Requery </li> Return to Access, and then save the page as C:\RequeryTest.htm.</li> View the page in Microsoft Internet Explorer 5 or later.</li> Click Start, click Run, type notepad C:\RequeryTest.xml in the Run box, and then click OK.</li> Change Speedy Express to Really Speedy Express, and then save and close the XML file.</li> Return to the page in Internet Explorer, and then click Requery.</li></ol>

Note that the CompanyName for Speedy Express did not change.

<div class="references_section">