Here's what I've got
VB Code:
Private Sub Form_Unload(Cancel As Integer) Cancel = True End Sub
Problem is, it closes any child forms even though it doesn't close the main form.
Is there a solution?
cory
Printable View
Here's what I've got
VB Code:
Private Sub Form_Unload(Cancel As Integer) Cancel = True End Sub
Problem is, it closes any child forms even though it doesn't close the main form.
Is there a solution?
cory
Try setting Cancel = True in the form's QueryUnload event instead.
What pnish said will work but you will have to do some 'IFing' or it will be impossible to close the application if you do only that.
Welcome to the forums...
try this...
VB Code:
Private Sub Form_Unload(Cancel As Integer) Cancel = 1 'Change True to 1 End Sub
Cancel can be any non-zero value. So Cancel = 1 will work exactly the same as Cancel = True (True = -1). If you wanted you could make Cancel = 12345 and it would work.Quote:
Originally Posted by modpluz
As I posted earlier, the solution is move the code to the QueryUnload event. ;)
Hey Guys,
Thanks for the help. It works great. I didn't even notice the QueryUnload event.
Thanks again,
Cory