Runtime 2007 error End command

  • Thread starter Thread starter gg
  • Start date Start date
G

gg

In Access 2007 runtime, I get these unexplained, until now, runtime errors,
even though I have error handling. I have just found that the culprit is the
End command in my code. As a test, I created a whole new program with just
one button with code that says End. Sure as the dickens, in runtime mode, I
get a runtime error that cares nothing about error handling. In macro the
code runs fine. Convert it to code and dies. I have gotten around it by
replacing End with goto XX and then locating xx: just above End Sub. It
works, but I am reluctant to issue this until I know what is happening. I
have done all the normal things that others on this site have told me,
including, make accde first, install error handling, remove libraries. I
uninstalled Accessruntime and reinstalled Any ideas? Going Nuts
 
gg said:
In Access 2007 runtime, I get these unexplained, until now, runtime errors,
even though I have error handling. I have just found that the culprit is the
End command in my code. As a test, I created a whole new program with just
one button with code that says End. Sure as the dickens, in runtime mode, I
get a runtime error that cares nothing about error handling. In macro the
code runs fine. Convert it to code and dies. I have gotten around it by
replacing End with goto XX and then locating xx: just above End Sub. It
works, but I am reluctant to issue this until I know what is happening. I
have done all the normal things that others on this site have told me,
including, make accde first, install error handling, remove libraries. I
uninstalled Accessruntime and reinstalled Any ideas?

I don't recall ever using End. I have Exit Sub and Exit Function and
I sometimes forget to remove Stops. But I don't ever recall using
End.

So I set this up myself. You're getting the following msg?

Execution of this application has stopped due to a run-time error.
The application can't continue and will be shut down.

If so yup, looks like that's normal behavior.

BTW if I'm doing basic validation at the top of a sub or function and
thus I haven't opened any recordsets or whatever I just do an exit
sub/function. No sense in even dropping down to the exit routine if
nothing was opened that needs closing.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
 
gg said:
In Access 2007 runtime, I get these unexplained, until now, runtime
errors, even though I have error handling. I have just found that
the culprit is the End command in my code. As a test, I created a
whole new program with just one button with code that says End.
Sure as the dickens, in runtime mode, I get a runtime error that
cares nothing about error handling. In macro the code runs fine.
Convert it to code and dies. I have gotten around it by replacing
End with goto XX and then locating xx: just above End Sub. It
works, but I am reluctant to issue this until I know what is
happening. I have done all the normal things that others on this
site have told me, including, make accde first, install error
handling, remove libraries. I uninstalled Accessruntime and
reinstalled Any ideas? Going Nuts

See the help topic:

http://msdn.microsoft.com/en-us/library/aa243356(VS.60).aspx

The End statement effectively ends any code execution, resets all
variables, ... and is generally not recommended in production apps.
 
Thanks much I'ts something MS should change as they insert end statements
when you use the macro conversion utility. When I first learned to code, I
read something that encouraged me to put insert "end" where I wanted things
to stop. In any case, a relief to know my problem is not unique and I won't
have to reload the main program. Thanks again.
 
gg said:
Thanks much I'ts something MS should change as they insert end statements
when you use the macro conversion utility.

I never knew that. Thanks.
When I first learned to code, I
read something that encouraged me to put insert "end" where I wanted things
to stop. In any case, a relief to know my problem is not unique and I won't
have to reload the main program. Thanks again.

Glad I was of some assistance as confused as I was.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
 
Back
Top