Close 3 forms with one click?

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
 
B

boblarson

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.
 
C

CW

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.
 
B

boblarson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top