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
On Microsoft Windows 95/98
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.
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.
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
- Open the sample database Northwind.mdb.
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
- View the form in Form view. You do not have to make any changes to any record on the form.
- Press CTRL+G to open the Immediate window.
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.
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.
Additional query words: msaccess exe
Keywords: kbbug kbdta kbofficeprog kbpending kbprogramming KB235222