Results 1 to 3 of 3
  1. #1
    LonghronJ is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jul 2015
    Posts
    150

    Check if a certain form is the only form open


    So, I have a switchboard type form that opens when the database is launched. The user then can go to other forms or reports in any order. When a command button is clicked on the switchboard, another form/report opens and the switchboard is minimized. Forms and reports can be open on top of each other. When the last form/report is closed, I'd like the switchboard form to restore itself. 1) What's the vb code to check if switchboard is the only object left after the last an object is closed? 2) I'd presume I'd have to insert the code to the On Close event on every form or report that can potentially be opened, or there's a better method?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Open the form you want ,then close the current form:

    docmd.openform "frmMainMenu"
    docmd.close "frmInvoice"

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    The only thought that comes to mind is looping the forms collection and using IsLoaded to see if each is loaded, keeping a count. You'd make a public function and call it from each form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 16
    Last Post: 06-21-2017, 08:44 PM
  2. Replies: 7
    Last Post: 04-01-2014, 02:08 PM
  3. How can I check if a Form is open?
    By Gezza in forum Forms
    Replies: 2
    Last Post: 02-07-2012, 06:31 PM
  4. How to check if a form is open.
    By ismith in forum Forms
    Replies: 2
    Last Post: 01-26-2012, 08:10 AM
  5. Replies: 2
    Last Post: 02-26-2010, 08:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums