ACC2000: Undo Method Causes IPF When Used Outside Form's Class Module (235222)
The information in 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).
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.
Note that your change was undone and that no error occurs.
STATUSMicrosoft 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.
REFERENCESFor 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.
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbbug kbdta kbofficeprog kbpending kbProgramming KB235222 |
---|
|