473,902 Members | 5,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access - Return to previous form

4 New Member
Hello guys.
In my project when I open a form the previous form is closed..
So I want to make a button that returns me to the previous form and closing the opened form

Example: FormA is open than I clicked a button that opened FormB and closed FormA now I clicked the "Previous" button that brought me back to FormA and closed FormB

I need to make this because I don't have time of making alot of macros
Apr 27 '12
15 17872
759 Contributor
That's cool Smiley !!!!!
Until now I have write a lot of extra-code in order to obtain the same effect.
Thanks !
Apr 30 '12 #11
32,584 Recognized Expert Moderator MVP
That's actually very interesting Smiley. I don't work much with multiple instances myself (as I rarely have the need), but I can see the benefit of handling them. I'm a little less convinced about getting this from the Screen object though (which is certainly clever, but not so logically robust). Do form instances not have unique values for their .Name parameters? I would tend to prefer code where the calling form identification was passed from the calling form itself. If that has to be the index value for Forms, then so be it, but if the .Name is unique then I'd go for that instead.

Does that make sense?
Apr 30 '12 #12
4 New Member
I have a question..
There is a way I can let the program know which form was the last form? and then just put it on a variable or something?
and than I can return to any form
Apr 30 '12 #13
32,584 Recognized Expert Moderator MVP
Yes. There are two methods already included for that in this thread :
  1. Post #5 Line #2 of the first block of code.
    This code passes the name of the calling form to the called form. Smiley has indicated this may not be reliable when multiple instances of the same form are opened concurrently (I cannot confirm this at this time).
  2. Post #10 Line #6.
    This code determines the active form (with the fairly reliable assumption that this will be the same as the form that called it) when the Form_Open() procedure is run. It can play tricks when the form is opened from the database window, and maybe in other scenarios I haven't considered, but is otherwise pretty reliable.
and than I can return to any form
You should appreciate that this is exactly what we've been discussing and suggesting solutions for all this time.
Apr 30 '12 #14
2,322 Recognized Expert Moderator Top Contributor
@ NeoPa

No instanced forms do not have unique names. I started using instanced forms while doing a review tool, in which the user would often want to copy/paste comments from 1 review into another review, and thus would like to have multiple reviews open at the same time. It does complicate things a bit sometimes, but its a very nice and handy feature.

Whether you could do it through the form collection and index, I dont really know. I haven't used that so much. A simple bit of error handling to the open and close procedure should take care of most issues, and if you have no frmPrevious to return to, simply open a default menu form. Another issue is that with instanced forms you can't (to my knowledge) pass openargs.
Apr 30 '12 #15
32,584 Recognized Expert Moderator MVP
Another issue is that with instanced forms you can't (to my knowledge) pass openargs.
Ah! That does rather put the kybosh on that approach then, for instanced forms at least. Thanks for the info.
May 1 '12 #16

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

Similar topics

by: Job Lot | last post by:
I have requirement where client has to call us to get a key to access a particular form. Secondly, I want the code to be valid for a day. Can some guide me in right direction to implement this requirement? How should I generate this code, validate it and let the code be active for a day? Thanks
by: MissiMaths | last post by:
I am creating a reference table of all the information used to draw a sample. I start by first clearing the table in form1 using a delete query. Then after the user selects certain options, i create a string "optionString" and put it into my table refTab in the appropriate field. DoCmd.OpenQuery "ClearRefTable" Dim MyDB As Database
by: John Michael | last post by:
I have created some password routines to protect certain forms from access without a password. This allows me to create some security for apps that will be used on diff machines for users that will not have to learn the whole access security process and me as well. I would like to lockup my database by unchecking all of the options in the tools/startup from. I know i can create custom menus, toolbars and command bars and add a link to...
by: Dman | last post by:
MS Access 2002 - query form control returns funny symbols like I am running an append query on a form. Access is having trouble with the calculated fields and comboboxes. Example – referring to forms!FormName!ControlName within the query should return the value of that control, correct? I am receiving symbols such as boxes or as well as Chinese symbols. Any thoughts as to why this is happening. thanks
by: Cheryl | last post by:
How can I create a button that would take me back to the previous form not the previous record, but the previous form that I just moved from using VBA? Any sample code would be greatly appreciated.
by: abhishekjethwani | last post by:
How to write a query to access tree structure form multi table. I m having five tables from them first table give me a data which act as the parameter for query for the second table and the two tables will give me parameter for the third and so on. at present i m writing five query and sending parameter to each query but i want an efficient way for this. its a parent child type relation.
by: Gilberto | last post by:
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
by: sweatha | last post by:
Hi Friends I have designed a form with 1 DropDownList box named “ddlShow_time”& the form name is “Default4.aspx”. Just like that, I have the database(SQL SERVER 2000) as Table Name: ShowTime ----------------------------------------------------------------------------- Theater_Name ShowTime Movie_Name ------------------------------------------------------------------------------- Udhayam 10:00am ...
by: danon | last post by:
Hi to you all can any one tell me how to programme a button so it can take back to the previous form please many thanks
by: mwh2385 | last post by:
I just cannot see clearly now...or I am just stupid, but I need a little help to getting the file ready in Access for the form that awaits it in Word. Now I think the correct procedure is that I set up a form in Word using the same field names in Access, but I'm not sure. I am running a Class Reunion database in which I have adding data for the last six months. Now I'm ready to send it into Word, buy I'm not sure what feature I need to run in...
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...
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...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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();...
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...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.