Close 3 forms with one click?

  • Thread starter Thread starter CW
  • Start date Start date
C

CW

I have three forms that are opened one after the other and kept open
together, in the course of creating an invoice.
When the third one has been completed and saved, I would like to have a
single click event that would close all three.
Ideally I would like to combine all the following:
Save frm3 + Close frm1 + Close frm 2 + Close frm 3
Hope somebody can help with the code I should put behind a cmd button (and
where)!
Many thanks
CW
 
All you need is this:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, Forms!YourForm1NameHere, acSaveNo
Docmd.Close acForm, Forms!YourForm2NameHere, acSaveNo
Docmd.Close acForm, Me.Name, acSaveNo

the Me.Name just leave as is, no change necessary. The other 2 put your
form name in. There are other ways to do this too, but with only 3 forms the
code is about the same length as the other ways, I believe.

--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
__________________________________
If my post was helpful to you, please rate the post.
 
Great - thanks a lot, Bob
CW

boblarson said:
All you need is this:

DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, Forms!YourForm1NameHere, acSaveNo
Docmd.Close acForm, Forms!YourForm2NameHere, acSaveNo
Docmd.Close acForm, Me.Name, acSaveNo

the Me.Name just leave as is, no change necessary. The other 2 put your
form name in. There are other ways to do this too, but with only 3 forms the
code is about the same length as the other ways, I believe.

--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
__________________________________
If my post was helpful to you, please rate the post.
 
CW -

If it isn't too much trouble, can you mark this question as answered?
--
Bob Larson
Access World Forums Super Moderator
Utter Access VIP
Tutorials at http://www.btabdevelopment.com
__________________________________
If my post was helpful to you, please rate the post.
 
Back
Top