You need to load a custom ribbon that disables selected parts of the File menu at startup. CARE needed with modifications of this type or you may lock yourself out!
Do you just want to remove the 'Close Database' item or other File menu items as well?
That's a different question entirely.
You originally asked about removing the Close Database 'button'
The Close button on a form closes that form ONLY
To do so, do ONE of the following in form properties:
1. Close Button = No. You may also want to set Control Box = No
2. Border Style = No
AFAIK there is no setting to do that globally for all forms at once in Access Options
However you could probably write code to loop through each form in turn and do that if you have a large number of forms
If you do this, make sure you include your own Close button on each form
As a side note, there's also the standard windows Close button at the top right of the Access window itself, which (AFIAK) can't be altered with the Ribbon.
There is some Windows API code that can be used to disable the button, but I tend to think it's a bit of a hack myself (changing the core UI things that people expect across every application doesn't usually do anyone any favors).
I won't bother to dig up the API code to do it as you don't seem to need it, but future readers may be interested to know and can probably find it with a little google-fu easily enough (or post back and someone will dig it up, probably in Stephen Lebans' or Dev Ashish's old codebanks).
Also - didn't the MS Access team add an Application Close event a year or two back? I seem to recall something along the lines, but not sure details offhand (ideally, this would let you do a little bit of cleanup prior to app close, because otherwise the only way was with a hidden form on startup, catching that close event, at which point Access is already half-shut down anyway - it's pretty messy). On a somewhat related note, I wrote an article about the weirdness of form events: Close, and Dirty, specifically: http://www.utteraccess.com/wiki/Form_Event_Quirks
You can stop the database from closing by cancelling the unload event of an open, even if hidden, form.
Here's sample code that only allows a form to close under certain conditions...
Code:
Private Sub Form_Unload(Cancel As Integer)
[COLOR="Green"]' only allow this form, and the app that hosts it,
' to close between 11am and noon
[/COLOR] Cancel = Hour(Time) = 11
End Sub