Solved

access:close one form open another and vice versa

Posted on 2011-03-02
7
343 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
  • 4
  • 3
7 Comments
 

Author Comment

by:topUKlawyer
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
Actually, I am mistaken.  No error even if the other form isn't open.
OM Gang
0
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:topUKlawyer
Comment Utility
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
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
sounds good, thanks

will test tomorrow and award points
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

762 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now