Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

access:close one form open another and vice versa

Posted on 2011-03-02
7
Medium Priority
?
350 Views
Last Modified: 2012-08-13
I have two forms linked to each other by command buttons.

I want to make sure that when one form opens the other closes and vice versa.

The reason I want to do this is to make sure that data is saved/updated when the other form is gone into. They have data common to one table.

Is there an easy way to achieve what I want.
0
Comment
Question by:topUKlawyer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 

Author Comment

by:topUKlawyer
ID: 35019920
when i say linked to each other i mean that one button opens the other form and vice versa.
0
 
LVL 28

Accepted Solution

by:
omgang earned 2000 total points
ID: 35020445
Try putting something like this in the Form_Open event for each form


Dim strFormName As String
strFormName = "OtherFormName"
DoCmd.Close acForm, strFormName

If the other form isn't actually open the DoCmd.Close command will throw and error but you can trap that in an error handler.  Let me get back to you.
OM Gang
0
 
LVL 28

Expert Comment

by:omgang
ID: 35020483
Actually, I am mistaken.  No error even if the other form isn't open.
OM Gang
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:topUKlawyer
ID: 35020496
Thanks

i would also like the dbase to open with one of those forms open.

how do i do that please?

0
 
LVL 28

Expert Comment

by:omgang
ID: 35020533
More than one way to accomplish that.  You can specify a startup form for the database; you can create a macro named Autoexec that will be executed each time the database opens - in the macro you have an OpenForm command to oepn the desired form.

What version of Access?
OM Gang
0
 
LVL 28

Assisted Solution

by:omgang
omgang earned 2000 total points
ID: 35020652
In Access 2003 and earlier:  from the Tools menu choose Startup.  In the combo box for Display Form/Page:  select the form you want to be displayed at startup

In Access 2007:  select the Access orb/globe/thing-a-majob and choose Access Options.  Select Current Database in the left pane.  In the right pane, in the Application Options section, you'll see a combo box titled Diaply Form: where you can select the form you want displayed at startup.

OM Gang
0
 

Author Comment

by:topUKlawyer
ID: 35020942
sounds good, thanks

will test tomorrow and award points
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question