I like to run some code when a user closes my ms 2000 app. This is being bypassed by the user pressing alt F4 and not using the exit buttons provided, how do i disable this functionality? Alternatively, is there a way to catch this and run some code. Im trying to avoid using a hidden form by the way.
You should be able to use an autokeys macro.
http://msdn.microsoft.com/en-us/library/aa159349%28office.10%29.aspx
EDIT re Conmments
It may suit to create a hidden start-up form or to use your main menu to cancel the close event unless your button is pressed:
Set the CloseButton propert of the form to No. You can alternately set the ControlBox property to No, which removes both the 'x' and the min max buttons.
In the declaration's area of the form's VBA code, define the following variable:
Public OK2Close As Boolean
In the form's OnLoad event, place the following code:
OK2Close = False
On your form should be a button to close the form (or Quit the application if on the Main screen). In the OnClick event for this button, place:
OK2Close = True DoCmd.Close '(or DoCmd.Quit for Main screen)
In the form's Unload event, place:
Cancel = Not OK2Close