Results 1 to 15 of 15
  1. #1
    ScottXe is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    25

    Close a form & return to Switchboard

    I open a form via Switchboard. After use, I click the Close (X) button and would like to close the form and return to Switchboard. I tried to put below code in On Close event but failed. The Switchboard appears for a short period of time and then both the form and the Switchboard are close all together. Can someone advise me how to accomplish this task.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    What 'below code'? We need something to review. Provide code or database for analysis.
    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.

  3. #3
    ScottXe is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    25
    Quote Originally Posted by June7 View Post
    What 'below code'? We need something to review. Provide code or database for analysis.
    Sorry for the omission.

    DoCmd.OpenForm “Switchboard”

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    That should work. Guess you better provide the db.
    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.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by ScottXe View Post

    ...I click the Close (X) button and would like to close the form and return to Switchboard...
    Just to be clear...you're talking about the Close (X) button on the secondary Form...not the Close (X) button on Access itself, correct?

    And are talking about a switchboard generated by the Switchboard Manager?

    Linq ;0)>

  6. #6
    ScottXe is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    25
    Thanks for your clarification. I checked it again. The users actually click the Close (X) button on Access itself since the form is in data sheet view where there are no Close, Restore down and Minimise buttons on the top right corner of the form. In data sheet view, how to close it?

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    The restore/min/max buttons can be disabled and not displayed for a form in any view, including datasheet.

    However, the X close button should always show for any form view. Question is - why don't you see it?

    Unless BorderStyle property is set to None.
    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.

  8. #8
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    In Form Design View

    • Go to Properties - Format
    • Set Control Box Property to Yes
    • Set Close Button Property to Yes
    • Set Border Style Property to anything except 'None'

    Linq ;0)>

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Thank you linq - I never noticed ControlBox property - I can use that. I usually disable the X close button but annoyed that it still shows and I did not want None for BorderStyle.
    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.

  10. #10
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    I have a button on my form and named it GO BACK. In the OnClick event, I have this code:

    DoCmd.Close acForm, "yourformeName", acSaveYes
    Forms!switchboard.Visible = True

    It takes me back to the switchboard but of course, prior to this I disabled the Close button and enabled only the minimise button.

    -just my 2 cents
    hope this helps

  11. #11
    ScottXe is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    25
    I now locate the reason for disappearing the title bar with close (x) form feature. When I open the form to maximised, the title bar will disappear. Once I remove the statement of opening form to maximised, the title bar appears. It does not resolve the problem completely. If the user click the maximise button on title bar, the form will go to maximised and the close form button disappears again. The users do not have any way to close the form after the use and need to close the database. How can this be avoided?

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Deactivate the minimize/maximize.
    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.

  13. #13
    ScottXe is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    25
    Yes, that is my way of handling it currently. It is not perfect as the user cannot use the full screen. Thanks!

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    If you want to allow full screen (I've never done this), maybe disable the X close and program a command button to close the form.
    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.

  15. #15
    ScottXe is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Aug 2012
    Posts
    25
    Thanks for all that responded. Problem resolved!

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

Similar Threads

  1. Replies: 4
    Last Post: 01-31-2014, 11:47 AM
  2. Use Switchboard to close db AND Access
    By HeadGasket in forum Forms
    Replies: 1
    Last Post: 02-01-2012, 07:08 PM
  3. Replies: 7
    Last Post: 09-13-2011, 01:38 PM
  4. Replies: 2
    Last Post: 06-20-2011, 03:10 PM
  5. Replies: 1
    Last Post: 12-21-2005, 12:27 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