Unload vs Terminate

I'm writing a program where a splash screen is displayed while the database connection is established, and then a login screen is presented to the user. I would like to arrange it so that if the user clicks the 'x' on the login screen, the entire application is shut down. What would be the cleanest way to do this? I can't really use the Form_Unload procedure since this will run even if the user logs on successfully and the form is unloaded. I don't know if I can make a direct call to the Form_Unload procedure of the splash form, but this is where my shut down code currently resides (unloading all of the forms etc). Can the Terminate procedure be used in this manner? What is the best way to accomplish this?
[745 byte] By [Broodmdh] at [2007-11-19 7:24:51]
# 1 Re: Unload vs Terminate
Not sure if this is what you are looking for, but you can call another form's Unload:

Unload FormName

Just make sure you don't have any references to FormName after calling the Unload or it will cause FormName to load again.
malleyo at 2007-11-9 20:44:42 >
# 2 Re: Unload vs Terminate
Even a splash screen is a form. It just has no border. So when you click the "X", just make sure that it unloads EVERY form in your project.

Unload FormName1
Unload FormName2
Unload FormName3
Unload FormName4.
PeejAvery at 2007-11-9 20:45:53 >
# 3 Re: Unload vs Terminate
If you have more than 1 form, you can use a loop to make sure they are all closed.

Dim frm As Form
For Each frm In Forms
If Not frm Is Nothing Then
Unload frm
Set frm = Nothing
End If
Next frm
malleyo at 2007-11-9 20:46:52 >
# 4 Re: Unload vs Terminate
Did you use .Show 1 in that splash screen to show the Login Screen? Maybe the easiest thing to do is use 'end' in the unload event of the login screen....

I think trying to use unload the splash screen would cause an error if that splash screen used .show 1 to show the Login screen.
d-u at 2007-11-9 20:47:52 >