473,473 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Load event of active form fires when Access closes

I've found an odd situation in where the Load event of the active form
fires (after the Unload event) when Access is closed. I am able to
reproduce this situation in Access 2002 SP3 and Access 2003 on
computers running WinXP. This does not appear to happen in Access 2000
on a computer with Win2000.

This only seems to happen if there is a hidden form also loaded and,
so far, I'm only able to reproduce this if the forms are loaded
through an autoexec macro.

Has anyone else run into this? Is there a solution? Am I doing
something horribly wrong? :-)

I can work around this particular situation, but am concerned that
events may be firing when they're not supposed to.
Steps to Reproduce:

1. launch Access
2. create a new (blank) database
3. create a new form in design view
4. select "View / Code" from the Access menu
5. enter (or copy and paste) the code below

Private Sub Form_Load()
MsgBox "Loading"
End Sub

Private Sub Form_Unload(Cancel As Integer)
MsgBox "Unloading"
End Sub

6. close and save the form as "Form1"
7. create a new form in design view
8. save the form as "Form2"
9. create a new macro
10. select "OpenForm" as the first command in the macro
11. enter or select "Form2" as the form to open and choose
"Hidden" as the Window Mode
12. select "OpenForm" as the second command in the macro
13. enter or select "Form1" as the form to open and choose
"Normal" as the Window Mode
14. close and save the macro as "autoexec"
15. select "Tools / Startup" from the Access menu
16. uncheck the "Display Database Window" option
17. close the database
18. re-open the database. The "Loading" message box should appear.
19. select "File / Exit" from the Access menu, or click the Close
control button on the Access window.

Result: The "Unloading" message box appears. After clicking OK, the
"Loading" message box appears. After clicking OK again, Access closes.

I've also added a button to Form1 that runs the DoCmd.Quit command
when clicked. Clicking the button has the same results (the Load event
fires after the Unload event).
Any ideas are welcomed. Thanks!

-- Dexter Lieu
Nov 13 '05 #1
0 2425

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Maxine G | last post by:
I have two forms, a menu and a data entry form. The entry form is bound to a query against linked SQL server tables. In the deactivate event, I have some code which asks the user if they want to...
4
by: Ben McLaurin | last post by:
When oopeening a form based of a table I need to run a function to do some calculations. Which form event do I need to use that will automatcally run when the form is opened but all the data from...
2
by: MLH | last post by:
A form named frmVehicleEntryForm has a number of textbox controls who's OnGotFocus property setting is an expression... =Change2Green() Change2Green() looks something like this... Dim MyControl...
7
by: MGFoster | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Access 2002 & 2003. Windows XP Professional O/S. According to the Access Help article "ApplyFilter Event" the "...ApplyFilter event occurs when...
7
by: Dan Nash | last post by:
Hi guys Ok, i have an aspx with a user control. In the user controls pageload i set a property (mystring = "test";). i then want to access that from the page_load of the aspx thats using the...
4
by: Bill Manring | last post by:
I need to capture the event when the user closes the browser in my application. I have some code in the session_End event, which works fine when the session times out, but I need to end the...
4
by: Rob Richardson | last post by:
Greetings! I have a form with a listview, a menu, and a few text boxes, labels and command buttons. I want to resize the listview when the form is resized to that the widths of the spaces...
8
by: Brian Fulford | last post by:
This is my first shot at a Winforms application in dot net. This application is mainly going to run unattended but is using a form to display current activity of the background processing. In VB6,...
2
by: Tom_F | last post by:
To comp.databases.ms-access -- I would like to trigger an event when I close a form -- but ONLY when the data in the "RecordSource" table has been updated. I tried using the AfterUpdate event,...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.