473,732 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Close Form after New Form Opened

7 New Member
I am also finding some difficulty with making my find client number form auto close when the client form opens.
I have tried adding code at the end of the private sub to open the client form and have also tried putting it in for example 'On Lost focus'.
All seem to fail and return an error message.
Some advice on the correct way to approach this problem would be much appreciated
Oct 13 '10 #1
2 1471
NeoPa
32,569 Recognized Expert Moderator MVP
This thread has been created by splitting off a new question from another thread (code to set the value of a query as the value in a control).

When I've finished tidying up I will return to offer an answer.
Oct 14 '10 #2
NeoPa
32,569 Recognized Expert Moderator MVP
Like you, I prefer a clean/tidy interface, and when control is passed from one form to another, I like the first to disappear leaving no confusion as to where the operator is at, at any time. This doesn't seem to be provided easily though. Let me give you some ideas to consider.

In a hierarchical structure, which I prefer - particularly for my menu systems, it is necessary for the menus earlier in the process to return, after the sub-menus (Not referring to Access Sub-Forms here) have been finished with, to the point of departure. In other words, to the point they were at just prior to relinquishing control to the sub-menu. For this to occur then, rather than closing the form, it need simply be hidden. When the called form (sub-menu) gets closed, it should be programmed to unhide the form that called it into being.

For closing the form, should you decide you still need to, you haven't posted any examples of code you've tried. That would have been helpful. However, the simple code is :
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.Close()
This can be more powerful, but when called with no parameters, closes the object where the code is found.
Oct 14 '10 #3

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

Similar topics

3
9334
by: Michael Charney | last post by:
I have a situation where on the forms load I ask for some date information. If the user decides to cancle out of entering a date, I want the form NOT to open. How would I do this. The VBA code is in the forms load procedure. Michael Charney *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
3
3050
by: Douglas Buchanan | last post by:
Buttons don't work if form is opened on startup A2k If 'frmMain' is set to open by default at startup none of the buttons work. If 'frmMain' is opened from the database window then all the buttons work. The form's name ('frmMain') is selected from in the Startup dialog box.
2
2907
by: Paul | last post by:
Hi this is related to a previous post, hopefully just a bit clearer description o the problem. I have a parent form that opens a new form (child form) while still leaving the parent form open. Although the child form has a close button (with java script) if the user navigates the parent form to another form the child form is still open. Just wondering if there is a way to close the child form when the user navigates away with the parent...
2
2009
by: Sezgin | last post by:
Hi Everyone, How can I close Serial Port opened by another program. Regards.
1
1166
by: reidarT | last post by:
Is it possible to close a form when the form is opened minimized by just clicking the icon in the taskbar? reidarT
4
10990
by: polocar | last post by:
Hi, I would like to find a way in C# so that, when the user presses the "Esc" key, the form closes; the problem is that I have a lot of controls in the form. At the beginning I have tried with the following form event handler: protected override void OnKeyPress(KeyPressEventArgs e) { base.OnKeyPress(e);
4
2952
by: Peter | last post by:
Access 2007 optionally opens forms as tabs. There is an Access Option that controls this - Access Options Current Database Document Window Options Tabbed Documents. But how, from VBA, can I programmatically tell whether or not a form is opened in Tabbed or Overlapping mode? I tried using Application.GetOption("Document Window Options")
3
1853
by: Alexio | last post by:
I need to enter a date into a text field when form is loaded. However I need this date to be static when the form is opened at a later date. I have the text box set to readonly. Will this be sufficient or do I need some type of Update function for when the form is opened again? <script language="javascript"> window.onload = function (){ var tDay = new Date(); tMonth = tDay.getMonth()+1; tDate = tDay.getDate();
2
1632
by: Steve | last post by:
I am working on a very large database that has a main menu, many sub-menus and a few sub-sub-menus. These menus typically have many command buttons that open forms and reports in the database. Forms and reports may also be opened from command buttons on some of the forms. 1. Is there any way to programatically determine where a sub-menu or sub-sub-menu is opened from? The code would need to reveal the name of the menu and the name of...
2
4057
TheSmileyCoder
by: TheSmileyCoder | last post by:
I have a form, which I open in dialog mode, and through the openArgs I set some values in the form (in a new record) thus dirtying the form. The idea is then that the user should make a selection in a combobox and then just close the form again. However, if you close the form without making a selection in the combobox, I do NOT want to save the record since its only half-finished. So I have simple code in the forms BeforeUpdate, to check...
0
8944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8773
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9445
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9306
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9180
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.