473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Closing previous form after opening new one

135 100+
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
3 1971
MikeTheBike
639 Expert 512MB
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
3,532 Expert 2GB
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
Gilberto
135 100+
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

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

Similar topics

3
by: Greg | last post by:
On my report I want to have an opening balance signifying all transactions up to the month selected and detailed transactions for the month selected and then a closing blance. I'm perpelexed...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
1
by: ss | last post by:
Hi I am opening a new form by: ChooseLeve chl = new ChooseLevel(); chl.owner = this; chl.close; i want that when the user clicks on button1 in chl (ChooseLevel), the preiouse form will be...
7
by: Martien van Wanrooij | last post by:
I have been faced a couple of times with the situation that I wanted to write a script and was worried about a too frequent opening and closing mysql connections. To give some examples: 1)I...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
3
by: sravan_reddy001 | last post by:
i want to prevent a form from closing.. to do this i want to handle the formClosing or FormClosed events. from here i want to prevent the form from closing. New instance of same form should...
1
by: Salad | last post by:
I have a form that opens another (intermediary) form. The user selects an option on the intermediary form and it opens another form and the intermediary form is closed. Ex: From MainForm...
11
by: Simon van Beek | last post by:
Dear reader, By opening an application I get always the main Access window with the closing cross in the above right corner. Is there a possibility to make this closing cross invisible? ...
2
by: =?Utf-8?B?RXRoYW4gU3RyYXVzcw==?= | last post by:
I am (still) relatively new to Windows applications, most of my experience has been Web based, and I am confused about what exactly happens when the Main() method is called and how to manipulate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.