when i shut down my computer will this save my work on exit
or is there a better way?
thanks
Code:Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call Savetime
Unload Me
End Sub
Printable View
when i shut down my computer will this save my work on exit
or is there a better way?
thanks
Code:Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call Savetime
Unload Me
End Sub
Form_QueryUnload is meant for cancelling the unloading (such as showing a "Are you sure you want to exit?" message), or potentially dealing with particular unloading modes (such as Task Manager is closing your app).
As you aren't doing either of those, you should be using Form_Unload instead.
Note that there is no reason to have Unload Me inside Form_QueryUnload. If you don't cancel via Form_QueryUnload, the form will unload automatically after Form_QueryUnload has been called.
I agree with si_the_geek comment, but, Yes, Form_QueryUnload will save your work!
But to be shore, replace your function with Beep and test it! ;)Code:Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call Savetime
End Sub
hey yall how do you make a program run something when you hit close button.
If you mean the "X" in the title bar, that is what Form_QueryUnload and Form_Unload are for.
ok cool thanks i think i got it, i put msgbox in there and its working