ACC2002: Record Appears to Be Deleted from XML Data Page Without Warning (282373)



The information in this article applies to:

  • Microsoft Access 2002

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

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

    CategoryName
    Description

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

    Note how many records are present.
  12. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  13. In the Immediate window, type the following and then press ENTER:
    DataAccessPages(0).MSODSC.DataPages(0).Recordset.Delete
    					
  14. 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.

REFERENCES

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

Modification Type:MajorLast Reviewed:10/20/2003
Keywords:kbbug kberrmsg kbpending KB282373