If you view a data access page in Microsoft Access, both the onbeforeunload and the onunload window events are executed. If you view the data access page directly in Internet Explorer 5 or later, both events are also executed. But if you click
Quick View in the Microsoft Script Editor, only the onunload event is executed; the onbeforeunload event is not executed.
Steps to Reproduce the Behavior
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.
- Open the sample database Northwind.mdb.
- In the Database window, click Pages under Objects, click the View Products page, and then click Design View.
- On the Tools menu, point to Macro, and then click Microsoft Script Editor.
- On the View menu in the Microsoft Script Editor, point to Other Windows, and then click Script Outline.
- In the Script Outline window, scroll down and expand the window node.
- Double-click onbeforeunload, and then type the following script:
MsgBox "On Before Unload"
- Double-click onunload, and then type the following script:
- Click the Quick View tab at the bottom of the Microsoft Script Editor.
- Click the Source tab at the bottom of the Microsoft Script Editor.
Note that only the message box in the onunload window event is executed. The message box in the onbeforeunload window event is not executed.