This is the function you are looking for.
http://www.mvps.org/access/api/api0019.htm
Problem is that if you don't have REALLY, REALLY good error handling, your
users could be left with only one way to close their application (the dreaded
Task Manager).
This will actually hide the application window, but in order for it to work,
all of your forms must be popup and modal (or something like that), which
carries with it a couple of other issues. One of the issues with this
technique is that when you hide the Access window, it no longer shows up in
the toolbar at the bottom of the Windows screen. So, if you allow your user
to minimize the application, the only way to get back to it is to use
Alt-Tab.
I've stopped using this in favor of turning off all of the user menu, hiding
the database window (or navpane in 2007), etc. The thing I was always afraid
of when keeping the Access window visible was that the X was always an
option, allowing the user to close Access without properly closing out of the
application. I prevent this from working by adding a little code to each of
my main forms.
1. First, I declare a variable that is Private to each form:
Public AllowClose as boolean
2. Next, in the forms Open event, I set AllowClose to False
3. In the forms unload event, I test to see whether AllowClose has been
reset to true (get to this in a second). If not, I set the Cancel to True
and display a warning message advising the user to close the form with the
"Close" button, or via my "Form" menu.
4. Lastly, I put a "Close" button or my "Form" menu on each of these forms.
In the click event of the "Close" button, I do something like the following:
Private Sub cmd_Close_Click
'add some code here to save or undo the changes to the
'current record
AllowClose = True
docmd.close acform, me.name
end sub
This way, when the user tries tries to close Access using the X (whether
intended or not), the form refuses to close.
--
HTH
Dale
email address is invalid
Please reply to newsgroup only.