Microsoft KB Archive/235222

= ACC2000: Undo Method Causes IPF When Used Outside Form's Class Module =

Article ID: 235222

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q235222



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

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



SYMPTOMS
If you invoke the Undo method of a form outside the form module, such as in a global procedure, a global function, or from the Immediate window, you may receive an error similar to one of the following:

Dr. Watson for Microsoft Windows NT
An application error has occurred and an application error log is being generated. MSACCESS.exe Exception: access violation (0xc0000005), Address: 0x3005e7c4

On Microsoft Windows 95/98
MSACCESS caused an invalid page fault in module MSACCESS.EXE at 015f:3005e7c4.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.



RESOLUTION
To resolve this problem, obtain Microsoft Office 2000 Service Release 1/1a (SR-1/SR-1a).

To obtain SR-1/SR-1a, click the article number below to view the article in the Microsoft Knowledge Base:

245025 OFF2000: How to Obtain and Install Microsoft Office 2000 Service Release 1/1a (SR-1/SR-1a)

To temporarily work around this problem do the following.

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

Instead of invoking the Undo method from a public module, call Form.Undo from the code module of the form, as in the following example:  Open the sample database Northwind.mdb.  Create a new form with the following characteristics:   Form: Test1 -  Caption: TestForm RecordSource: Categories

Command button Name: Button0 Caption: My Button OnClick: Event Procedure

Text box ---  Name: CategoryName ControlSource: CategoryName

Text box --  Name: Description ControlSource: Description  In Design view, right-click the command button, and click Build Event on the menu that appears.  Click Code Builder, click OK, and type the following code in the resulting module: Private Sub Command0_Click Form.Undo End Sub  View the form in Form view and make a change to the description of any record. Click the command button.</li></ol>

Note that your change was undone and that no error occurs.

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was corrected in Microsoft Office 2000 SR-1/SR-1a.

<div class="moreinformation_section">

MORE INFORMATION
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

Steps to Reproduce Behavior
<ol> Open the sample database Northwind.mdb.</li>  Create the following new form. and then save it Test1: <pre class="fixed_text">  Form: Test1 -  Caption: TestForm RecordSource: Categories

Text box ---  Name: CategoryName ControlSource: CategoryName

Text box --  Name: Description ControlSource: Description </li> View the form in Form view. You do not have to make any changes to any record on the form.</li> Press CTRL+G to open the Immediate window.</li>  With the form open, type the following in the Immediate window, and then press ENTER: Forms("Test1").Undo </li></ol>

Note that you receive one of the errors described in the "Symptoms" section of this article.

<div class="references_section">