cancel unload event on mainform from subform unload event???

  • Thread starter Thread starter clawdogs
  • Start date Start date
C

clawdogs

hi people. first thanks to all those helping us novices how to code
correctly. thanks a bunch!
here's my dilemma... i have a main form "Accounts" that "quits"
access on unload via macro. i have subform "Accountssubformm" that
i'd like to code its "unload" or "close" event to "close" the main
form without triggering the main form's unload event. I'd like a real
close on the main form, not minimize or hide etc. I'd also like to
immediately re-open the "Accounts" main form as if being opened from
the main database window. Can this be done? Here's how the subforms
unload event looks so far...

Private Sub Form_Unload(Cancel As Integer)
DoCmd.Close acForm, "Accounts", acSaveYes
If Me.Unload Then Me.Unload = False '<<<------------- THIS IS
WHERE I"M HAVING TROUBLE...
DoCmd.OpenForm "Accounts"
End Sub
 
hi people. first thanks to all those helping us novices how to code
correctly. thanks a bunch!
here's my dilemma... i have a main form "Accounts" that "quits"
access on unload via macro. i have subform "Accountssubformm" that
i'd like to code its "unload" or "close" event to "close" the main
form without triggering the main form's unload event. I'd like a real
close on the main form, not minimize or hide etc. I'd also like to
immediately re-open the "Accounts" main form as if being opened from
the main database window. Can this be done? Here's how the subforms
unload event looks so far...

Private Sub Form_Unload(Cancel As Integer)
DoCmd.Close acForm, "Accounts", acSaveYes
If Me.Unload Then Me.Unload = False '<<<------------- THIS IS
WHERE I"M HAVING TROUBLE...
DoCmd.OpenForm "Accounts"
End Sub


So far as I can tell, the Unload event of the main form precedes the Unload
event of any subforms on the main form, so this is not going to work.
That's assuming, of course, that you really mean a subform (as displayed in
a subform control on the main form), and not just a separate standalone form
that is related in some way to the "main" form.

What is the actual, real-world problem that you're trying to solve? Why do
you want to do what you are attempting? There is likely to be some other
way to accomplish it.
 
Back
Top