Results 1 to 3 of 3
  1. #1
    danilogg is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    1

    If any form is open, do not open this one


    I am a beginner using access 2010
    Have "Main Menu" form with buttons to open other forms. In every button there are two steps.
    1- Close this window (Main Menu)
    2- Open the desired form
    In all forms (except "Main Menu"), in the event close, I have the macro that opens the form "Main Menu" to have a form to go back and complete the navigation.
    These are the steps to put you in context:

    • In the "Main Menu" form, click the button "Assets List" that opens the form "Assets List" in a datasheet style.
    • The first column of this datasheet is a Hyperlink that opens the the form "Asset Details", using the selected ID but does not close the "Asset List".
    • With the "Asset Details" open, I can edit all the fields of the selected asset.
    • When close the "Asset Details" form, I requery the "Assets List" form, but because I have in the "on close" event of all the forms the macro to open "Main Menu", now I have "Main Menu" and "Assets List" open.

    What I want is: Before Load "Main Menu" ask if there is any form open. If yes, do not open "Main Menu". If there is no other form open, open "Main Menu".
    I guess that I should write a the code in the "on open" event in the "Main Menu" form, but I do not know what to write. Could you please help me?

    If there is a different way, I am open to new suggestions.

    Thanks,

    Danilo
    Last edited by danilogg; 03-13-2013 at 10:43 AM. Reason: Add more detail

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    DoCmd.Close acForm, Me.Name

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    I have MainMenu open as default when database opens. MainMenu never closes. All other forms open on top.

    Check to see if any form is open requires VBA to cycle through all form objects and check their state with IsLoaded property.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 10
    Last Post: 06-13-2012, 05:57 AM
  2. Replies: 1
    Last Post: 05-03-2012, 02:25 PM
  3. Replies: 2
    Last Post: 02-26-2010, 08:14 AM
  4. Replies: 1
    Last Post: 06-04-2009, 07:43 AM
  5. Form will not open
    By dserbanescu in forum Forms
    Replies: 0
    Last Post: 01-09-2008, 09:48 AM

Tags for this Thread

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