API for kicking off Access

  • Thread starter Thread starter Milan
  • Start date Start date
M

Milan

Hello,

I would like to ask you if you know some API function which would be
able to kick off Access application immediately (without saving
unsaved records and without running verifying procedures while exiting
focused control and form). I can not use DoCmd.Quit or
Application.Quit because I need to skip all the lost-focus,
after-update, exit and close event procedures.

I want to use this API function in my general ErrorHandler procedure.
When any unexpected error raises, description of this error is added
into some special table and the application should quit without
displaying any msgbox like "You have input invalid number", "Do you
want to save changes", "Corruption of primary key" etc.

Thank you very much.
 
Hi,

Couldn't you just set thhe warnings to false in your error handler, write
the record to the table you want, then issue DoCmd.Quit?

e.g. to demonstrate

Private Sub cmdTestError_Click()
On Error GoTo Err_cmdTestError
Err.Raise (13) 'Create a fake Type Mismatch error
DoCmd.Quit
Err_cmdTestError:
DoCmd.SetWarnings False 'Switch off warnings
Resume Next 'Resume on next line of code after
error
End Sub
 
Hello,

thank you very much for your answer. The problem is that
DoCmd.SetWarnings affects only Access-inbuilt message boxes. But I
have created a great number of my own warnings and msgboxes which may
display during execution of event procedures connected with closing
forms. It would be very strenuous for me to go through all the VBA
code in such event procedures and adjust them so that they would be
left out in the case of generation of unexpected error.

Thanks, Milan.
 
Back
Top