• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 625
  • Last Modified:

How to hide and unhide forms?

I have a form used as a switchboard.  Buttons on it to open several forms.  To open a form, I use me.invisible=false then call the opening of the designated form with docmd.openform.... and pass me.name in the openargs.
When I am finished with the opened form, I want to close it or hide it and make the switchboard visible again.  Which I do currently in the on click event of the forms close form button by making the currently open form hidden with me.visible=false and calling forms (me.openargs).visible, which hides the open form and shows the switchboard form.  If I click on the switchboard button to reopen the same form as before, it does not open maximized since the onopen event does not trigger.  Ideally I would like to close the second form and unhide the switchboad from the unload event.  However if I put a docmd.close in the forms close form onclick event, it makes the openargs null and throws an error if I use forms (me.openargs).visible in the forms unload event.
What is the best way to handle this?

Thanks,
John
0
leachj
Asked:
leachj
  • 4
  • 3
  • 2
1 Solution
 
mbizupCommented:
<<.  However if I put a docmd.close in the forms close form onclick event>>

Since you are using a command button to close your form, try unhiding the switchboard in the same click event - immediately before your docmd.Close statement (instead of in the unload event)
0
 
leachjAuthor Commented:
mbizup,
When I do that, it does not fully close or redraw the screen.  The switchboard does become visible but on top of  the image of the other form and not centered as it is from first launch.  The other form is not active, it looks like the whole thing needs to be redrawn somehow.  Kinda ugly lookin'.
0
Technology Partners: 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!

 
leachjAuthor Commented:
user_n,
Your link point to CSS code not access.
0
 
user_nCommented:
My mistake. Sorry
0
 
mbizupCommented:
Can you post a sample, with any sensitive data obscurred or removed.
0
 
leachjAuthor Commented:
Here's the db.  Click on the open patient list button and then click on the close button when the other form opens.
JourneysDB1.mdb
0
 
mbizupCommented:
Gotcha.

I didn't understand your last comment clearly.  

When you use docmd.Maximize, it affects the database as a whole, not just the form you are working with.

To return to a 'normal size' you need to use docmd.Restore.

So in your close button:

1.  unhide the switchboard
2.  Docmd.Restore to 'unmaximize' the screen.
3.  Docmd.Close acForm, Me.Name  '<--- close the edit form
0
 
leachjAuthor Commented:
Thanks, didn't know that....obviously.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now