Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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).

↑ Back to the top


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.

↑ Back to the top


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:
  1. Open the sample database Northwind.mdb.
  2. 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
    					
  3. In Design view, right-click the command button, and click Build Event on the menu that appears.
  4. Click Code Builder, click OK, and type the following code in the resulting module:
    Private Sub Command0_Click()
       Form.Undo
    End Sub
    					
  5. View the form in Form view and make a change to the description of any record.
  6. Click the command button.
Note that your change was undone and that no error occurs.

↑ Back to the top


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.

↑ Back to the top


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

  1. Open the sample database Northwind.mdb.
  2. Create the following new form. and then save it Test1:
       Form: Test1
       -------------------------
       Caption: TestForm
       RecordSource: Categories
    
       Text box
       ---------------------------
       Name: CategoryName
       ControlSource: CategoryName
    
       Text box
       --------------------------
       Name: Description
       ControlSource: Description
    					
  3. View the form in Form view. You do not have to make any changes to any record on the form.
  4. Press CTRL+G to open the Immediate window.
  5. With the form open, type the following in the Immediate window, and then press ENTER:
    Forms("Test1").Undo
    					
Note that you receive one of the errors described in the "Symptoms" section of this article.

↑ Back to the top


References

For more information about the Undo method, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type undo in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB235222, kbprogramming, kbpending, kbofficeprog, kbdta, kbbug

↑ Back to the top

Article Info
Article ID : 235222
Revision : 4
Created on : 10/11/2006
Published on : 10/11/2006
Exists online : False
Views : 335