Results 1 to 10 of 10
  1. #1
    billgyrotech1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2019
    Posts
    179

    Hide Min / Max and Close Title Bar on Database Open

    Hello,

    The Switchboard is set when opening the database. There is a title bar on top that has Min/Max and Close buttons. Can these be hidden? On my Switchboard I have a button to Exit the application so the user doesn't need the title bar.

    Thank you

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Look at form Format properties

    CloseButton
    MinMaxButtons
    ControlBox
    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
    billgyrotech1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2019
    Posts
    179
    Thank you but I don't see it. Can you please help me find where?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Open form in design view.

    Open Properties dialog.

    Make sure form object is selected.

    Look at Format tab.
    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
    billgyrotech1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2019
    Posts
    179
    I am referring to the database title bar above the Switchboard form thanks.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Disabling the app X close is tricky. I have never figured out how to hide the X Close at top right nor the X Close in the app icon right click menu. I think this code was originally written in Access 2007.

    Code in a general module:

    Code:
    Option Compare Database
    Option Explicit
    'API function to disable the X Close button is for 32-bit machine
    'If Lab gets 64-bit machines use the Unload event of Menu form to capture Access X close and Office button Exit
    Private Declare PtrSafe Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal wRevert As Long) As Long
    Private Declare PtrSafe Function EnableMenuItem Lib "user32" (ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long
    
    
    Public Sub SetAccessXCloseButton(pfEnabled As Boolean)
    ' Comments: Control the Access close button.
    '           Disabling it forces the user to exit within the application
    ' In      : pfEnabled       TRUE enables the close button, FALSE disabled it
    ' Owner   : Copyright (c) 2008-2009 from FMS, Inc.
    ' Source  : Total Visual SourceBook
    ' Usage   : Permission granted to subscribers of the FMS Newsletter
    On Error Resume Next
    Const clngMF_ByCommand As Long = &H0&
    Const clngMF_Grayed As Long = &H1&
    Const clngSC_Close As Long = &HF060&
    Dim lngWindow As Long
    Dim lngMenu As Long
    Dim lngFlags As Long
    lngWindow = Application.hWndAccessApp
    lngMenu = GetSystemMenu(lngWindow, 0)
    If pfEnabled Then
      lngFlags = clngMF_ByCommand And Not clngMF_Grayed
    Else
      lngFlags = clngMF_ByCommand Or clngMF_Grayed
    End If
    Call EnableMenuItem(lngMenu, clngSC_Close, lngFlags)
    End Sub
    Then I call that procedure in form Open event. Form is MainMenu set to open by default when db opens and never closes until user exits db.
    If Me!Permissions <> "admin" Then Call SetAccessXCloseButton(False)

    Here is form Unload event code:
    Code:
    Private Sub Form_Unload(Cancel As Integer)
    'only administrator is permitted to close DB with Office button exit if forms other than Menu are open
    'other code disables the X close for non-admin users so this procedure should only run for admin
    If Me!Permissions <> "admin" Then
        If Forms.Count > 1 Then
            MsgBox "Do not use the Office button Exit or X Close to quit database. Use the Menu screen Quit button."
            Cancel = True
        End If
    End If
    End Sub
    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.

  7. #7
    billgyrotech1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2019
    Posts
    179
    Wow I didn't realize it was so much trouble. Very sorry about that.

  8. #8
    billgyrotech1 is offline Competent Performer
    Windows 10 Access 2010 64bit
    Join Date
    May 2019
    Posts
    179
    I will try to do something else. I have some computers that are Windows 7 and some Windows 10 with some are 32bit and others 64bit.

    So it may cause issues with the code.

    I will revisit on Monday. I have the weekend chores to do now. Thank you very much for helping me when others aren't due to my poor manners before.

    I am trying to get past the problems I face and not take it out on others.

    Take care for now

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Code works on 64-bit because of PtrSafe modifier. I don't think the Unload code turned out to be needed after all.

    The only way to actually hide both app X Close may be to hide the app Window, something I have never attempted.

    Keep in mind this setup can be bypassed by holding shift key while opening db. Disabling shift key bypass is also something I've never attempted.
    Last edited by June7; 06-07-2019 at 07:58 PM.
    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
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,979
    If you want to explore hiding the application window and/or ribbon, you might find my example database useful.
    See http://www.mendipdatasystems.co.uk/c...ace/4594365418
    It works in all versions/bitnesses of Access from 2010 onwards
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 7
    Last Post: 02-19-2016, 11:14 PM
  2. Replies: 3
    Last Post: 08-20-2015, 10:31 AM
  3. Replies: 12
    Last Post: 12-06-2014, 06:29 PM
  4. Replies: 1
    Last Post: 03-02-2014, 01:31 PM
  5. Replies: 1
    Last Post: 01-06-2011, 11:23 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