Microsoft KB Archive/282373

= ACC2002: Record Appears to Be Deleted from XML Data Page Without Warning =

Article ID: 282373

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q282373



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies only to a Microsoft Access database (.mdb).



SYMPTOMS
When you attempt to programmatically delete a record in a data access page that is bound to Extensible Markup Language (XML), you may not receive a message that this operation is not permitted. Instead, it appears that you have deleted a record, although the underlying data source remains unchanged.



CAUSE
This behavior can occur if you are using the Delete method of the Recordset property to delete a record that does not display a warning message.



RESOLUTION
To restore the data that appears to have been deleted, refresh the page in Microsoft Internet Explorer. If your page is open in Access, you may refresh the page as follows:
 * 1) Open the data access page in Design view.
 * 2) On the View menu, click Page view.

Notice that the record that appeared to be deleted is now displayed.



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



MORE INFORMATION
Although you cannot delete records from a page bound to XML, you may use the following DeleteRecord method of the DataPage object to delete a record when the page is bound to a database: MSODSC.CurrentSection.DataPage.DeleteRecord This method returns the following error message if used on a data access page that is bound to XML:

You can't add a new record or delete an existing record because the recordset for this page is read-only.

Steps to Reproduce the Problem
 Start Microsoft Access, and then, in the New File task pane, click Blank Data Access Page. In the Select Data Source dialog box, navigate to the folder that contains the sample database Northwind.mdb, select Northwind, and then click Open. Right-click on the page, and then select Page Properties. On the Data tab, change the UseXMLData property to True. On the View menu, click Field List to make it visible, if it is not already visible.</li> In the Field list, double-click the Categories table.</li> Drag the following fields to the data access page:

CategoryName

Description

</li> Press CTRL+G to open the Immediate window in the Visual Basic Editor.</li>  In the Immediate window, type the following, and then press ENTER: DataAccessPages(0).MSODSC.ExportXML </li> On the File menu, click Close and Return to Microsoft Access.</li> On the View menu, click Page View.

Note how many records are present.</li> On the Tools menu, point to Macro, and then click Visual Basic Editor.</li>  In the Immediate window, type the following and then press ENTER: DataAccessPages(0).MSODSC.DataPages(0).Recordset.Delete </li> On the File menu, click Close and Return to Microsoft Access.

Notice that the Category Name box and the Description box are blank in the current record.</li></ol>

<div class="references_section">