Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switching to New Form

Status
Not open for further replies.

KnowledgeSeeker

Programmer
Feb 19, 2002
5
US
I have an application that has a switchboard open a form which, in turn, opens a number of other forms, closing each "old" form as it goes to the new one. The problem I have is that as each form is opened and the old one is closed, the switchboard form appears on the user's monitor momentarily and is distracting to the application. Ideally I would like to be able to have the new form open on top of the old form and then have the old form then be closed in the background so there is no apparent visual "break" in between the two screens. Sounds simple, I'm sure. But how can I do it? I can't seem to figure it out - perhaps because this is all so new to me. %-) Thanks!
 
Here are the steps for that process - it's very common, but not intuitive:

Form1:
yada yada yada
Docmd.Openform "Form2"
(form1 stays open)

Form2
(Has now opened in front of Form1)
DoCmd.Close acform "Form1"

You need to used an explicit reference to Form1 in the Close command in Form2. If you just issue the Close command by itself, it closes the current object, which in this example would have been Form2

So code like this wouldn't work:

Form1:
....
DoCmd.Openform "Form2"
DoCmd.Close <--- with the idea of closing form1
...

Those two lines would have opened Form2 (thus giving it the focus) and then immediately closed it. Confusing, to say the least.

To save some work, you might evaluate the use of the .VISIBLE property to do this instead.

Form1:
.....
Me.Visible = False
DoCmd.OpenForm &quot;Form2&quot;
....

The nice thing about INVISIBLE forms is that you can still refer to controls and values on them. Plus, they tend to 'snap' open again, giving your application the veneer of speed.














Remember, you're unique - just like everyone else
You're invited to visit another free Access forum:
or my site,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top