i think you can't.i have removed the tool bar with
#If VBA7 Then
Private Declare PtrSafe Function GetSystemMenu Lib "USER32" (ByVal hWnd As LongPtr, ByVal wRevert As Long) As LongPtr
Private Declare PtrSafe Function EnableMenuItem Lib "USER32" (ByVal hMenu As LongPtr, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long
#Else
Private Declare Function GetSystemMenu Lib "USER32" (ByVal hWnd As Long, ByVal wRevert As Long) As Long
Private Declare Function EnableMenuItem Lib "USER32" (ByVal hMenu As Long, ByVal wIDEnableItem As Long, ByVal wEnable As Long) As Long
#End If
Public Function EnableAccessCloseButton(pfEnabled As Boolean)
' Comments: Control the Access close button.
' Disabling it forces the user to exit within the application
' Params : pfEnabled TRUE enables the close button, FALSE disabled it
' Owner : Copyright (c) 2008-2011 from FMS, Inc.
' Source : Total Visual SourceBook
' Usage : Permission granted to subscribers of the FMS Newsletter
' Reference http://www.fmsinc.com/microsoftaccess/startup/preventclose.asp
On Error Resume Next
Const clngMF_ByCommand As Long = &H0&
Const clngMF_Grayed As Long = &H1&
Const clngSC_Close As Long = &HF060&
#If VBA7 Then
Dim lngWindow As LongPtr
Dim lngMenu As LongPtr
#Else
Dim lngWindow As Long
Dim lngMenu As Long
#End If
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
it does not let me, it brings up a box "Stop all macros" and the only option is to do it.
you Allow the Macro or just double click Autoexec macro to run it.it does not let me, it brings up a box "Stop all macros" and the only option is to do it.
I have added the following code (from your sample) into the load event@Sepp1945
If you don't need the title bar at all, then the close button is easy to remove. There are at least two possible approaches
1. Hide the Access application interface completely
2. Remove the title bar buttons
Both of these are explained in my article
![]()
Control Application Interface
This article discusses how the Access application interface can be controlled including hiding the navigation pane, ribbon or the entire application interface. Some methods can help make a database more secure. The example app opens with a form 'floating independently' on the desktop. Various...www.isladogs.co.uk
Sorry,my mistake, will research again,That code refers to command buttons from the main form and to a function UISetRoundRect which is in a separate module.
Why did you select that button code rather than look at my own Form_Load event code?
You can't just randomly copy code and expect it to work. You need to study the code to make sure you understand which parts to use
Perhaps it would be easier for you to start with the simpler example RemoveTitleBarButtons elsewhere in that article
I used now your code from the actual selection,Sorry,my mistake, will research again,
Many thanks
Sepp
SetAccessWindow (SW_SHOW)
HideRibbon 'v3.43