By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,183 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,183 IT Pros & Developers. It's quick & easy.

Closing previous form after opening new one

100+
P: 135
Hello

This must be pretty simple but i havent found the way to do it.

I have a form with a button that opens another form on click. WHAT command and WHERE do i need to CLOSE the previous form (first form) after clicking the button the opens the new one??

Ive tried docmd.close in several events but it doesnt work.

Thanks,
Gilberto
Oct 9 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 635
Hello

This must be pretty simple but i havent found the way to do it.

I have a form with a button that opens another form on click. WHAT command and WHERE do i need to CLOSE the previous form (first form) after clicking the button the opens the new one??

Ive tried docmd.close in several events but it doesnt work.

Thanks,
Gilberto
Hi

I think what you need is this

DoCmd.Close acForm, "NameOfFormToClose"

or even

DoCmd.Close acForm, Me.Name ?

Somewhere after the Open form command.

MTB
Oct 9 '07 #2

missinglinq
Expert 2.5K+
P: 3,532
On the button on your first form

Expand|Select|Wrap|Line Numbers
  1. Private Sub OpenSecondForm_Click()
  2.     DoCmd.OpenForm "SecondForm"
  3.     DoCmd.Close acForm, "FirstForm"
  4. End Sub
  5.  
Linq ;0)>
Oct 9 '07 #3

100+
P: 135
On the button on your first form

Expand|Select|Wrap|Line Numbers
  1. Private Sub OpenSecondForm_Click()
  2.     DoCmd.OpenForm "SecondForm"
  3.     DoCmd.Close acForm, "FirstForm"
  4. End Sub
  5.  
Linq ;0)>

Thanks Linq this worked perfectly.
Oct 10 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.