Article ID: 92810
Article Last Modified on 1/18/2007
APPLIES TO
- Microsoft Access 1.0 Standard Edition
- Microsoft Access 1.1 Standard Edition
- Microsoft Access 2.0 Standard Edition
- Microsoft Access 95 Standard Edition
- Microsoft Access 97 Standard Edition
This article was previously published under Q92810
Novice: Requires knowledge of the user interface on single-user computers.
SYMPTOMS
The BeforeUpdate macro appears to be running twice rather than only once.
CAUSE
The BeforeUpdate macro will run whenever an edited record is saved. And if you add records using the Paste Append command, it will run when each of those records is added. If you find that the BeforeUpdate macro is running more than once, check to see exactly what actions you are taking.
STATUS
This behavior is by design.
MORE INFORMATION
Steps to Reproduce Behavior
- Create a macro with a MsgBox action and a CancelEvent action.
- Save this macro as Macro1.
- Create a form based on any table and add a text box.
- Set the form's BeforeUpdate property to the Macro1 macro.
- View the form in Form view.
- Enter data in a field, and then select the data in that field.
- On the Edit menu, click Copy.
- On the Edit menu, click Paste Append.
- Click OK when the Message box (that you created in the Macro1 macro) appears.
- Close the form.
- Click OK when the Message box (that you created in the Macro1 macro) appears.
- Click OK when the following error message appears.
In Microsoft Access 7.0 and 97:
In Microsoft Access versions 1.x and 2.0:
Note that the message box you created in Macro1 reappeared in step 11. The macro that you assigned to the BeforeUpdate property is running twice: once when the record that you added using the Paste Append command is saved, and twice when the edited record is saved.
REFERENCES
For more information about form event properties, search the Help Index for "Events" and then select "Find out when events occur," or ask the Microsoft Access 97 Office Assistant.
For more information about form event properties, search the Help Index for "BeforeUpdate, AfterUpdate Properties," or ask the Microsoft Access 97 Office Assistant.
Keywords: kbprb kbusage KB92810