"Chris K" <(E-Mail Removed)> wrote in
news:S2Xao.61349$GQ5.20691@hurricane:
> This is the opening code in my (start up) form
>
> Private Sub Form_Load()
>
> If Date - DateValue(Version.Caption) > 5 Then Quit
Application.Quit closes the application, if that's what you want to
do.
> I've tried Quit, Docmd.Quit, End, Exit and in all cases it
> continues to execute code grrrrrrrrrrrr until it finds an error in
> Form_Current procedure and I dont want it to go that far - I just
> want it to stop, which I've also tried by the way
>
> btw, How can I switch errors On?
What do you mean by that?
There is an interaction between what's in your code and the settings
in the VBE's Options page.
> I understand that Resume signifies where/when the execution
> process can continue but does this also switch errors back on? -
> it's not specifically mentioned in the help files
On Error GoTo errHandler
- passes controller to a label when there's an error
On Error GoTo 0
- turns off any defined error statement, and returns to the state
where there is no error handler defined (i.e., you'll get the
default error)
On Error Resume Next
- ignore any error following and move on to the next line
In general, On Error Resume Next should not be used with more than
one line at a time, and should always be followed by an On Error
GoTo statement to restore either your local error handler or VBA's
default error handling.
I avoid On Error Resume Next and instead prefer to ignore an
expected error in the error handler. The reason is that On Error
Resume Next will ignore all errors, even the ones you're not
expecting.
> I cant help but feel that errors are being suppressed (Resume Next
> style) until it literally gets bogged down it cant possibly run
It's not clear from your description of the problem that error
handling has anything to do with your problem. You're just not using
the right command to quit the app if your condition is met.
--
David W. Fenton
http://www.dfenton.com/
contact via website only
http://www.dfenton.com/DFA/