• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 786
  • Last Modified:

AllowBreakIntoCode and Error Handling

Hi,
I have an Access adp project that we use as a front-end to a SQLServer db. In production, I've set the AllowBypassKey and AllowBreakIntoCode properties to False to keep users away from code. Well that works a treat but all unhandled errors now are suppressed - and guess what, the error handling in the Access code is less than superior. So when an unhandled exception occurs and the AllowBypassKey and AllowBreakIntoCode are set, Access ignores the error and the user doesn't know that anything went wrong.
Is there a better way of doing this? Is there some way to implement a generic error handler that handles errors that occur application-wide without have to add "on error" statements everywhere (lazy, I know)?

If this helps, here are all the settings we have when the project is put into production:

    CurrentProject.Properties.Add "AllowFullMenus", True
    CurrentProject.Properties.Add "AllowShortCutMenus", True
    CurrentProject.Properties.Add "StartUpShowDBWindow", True
    CurrentProject.Properties.Add "AllowBuiltInToolbars", True
    CurrentProject.Properties.Add "AllowBypassKey", True
    CurrentProject.Properties.Add "AllowBreakIntoCode", True
    CurrentProject.Properties.Add "AllowToolbarChanges", True
    CurrentProject.Properties.Add "AllowSpecialKeys", True

Is the only solution to turn off AllowBreakIntoCode?

Thanks for any guidance....
0
ctudorprice
Asked:
ctudorprice
  • 3
  • 3
  • 2
  • +1
3 Solutions
 
ctudorpriceAuthor Commented:
p.s. Access 2002/3 & .adp
0
 
ctudorpriceAuthor Commented:
p.s. again, sorry the code I gave turns everything ON, here's what we actually do:

    CurrentProject.Properties.Add "AllowFullMenus", False
    CurrentProject.Properties.Add "AllowShortCutMenus", False
    CurrentProject.Properties.Add "StartUpShowDBWindow", False
    CurrentProject.Properties.Add "AllowBuiltInToolbars", False
    CurrentProject.Properties.Add "AllowBypassKey", False
    CurrentProject.Properties.Add "AllowBreakIntoCode", False
    CurrentProject.Properties.Add "AllowToolbarChanges", False
    CurrentProject.Properties.Add "AllowSpecialKeys", False
0
 
rockiroadsCommented:
Im not aware of any
as far as I know, all error handling is done per procedure
the only global level I know off is in bounded forms where u have the OnError event handler

Its good practice to manage errors anyway

Where abouts is it failing? perhaps u can consolidate your code and merge functions together, make then have arguments,(+ optional) so it does different things on similar funcs depending on what is passed in
then put error handling in there
0
Granular recovery for Microsoft Exchange

With Veeam Explorer for Microsoft Exchange you can choose the Exchange Servers and restore points you’re interested in, and Veeam Explorer will present the contents of those mailbox stores for browsing, searching and exporting.

 
rockiroadsCommented:
Another option is to create a generic error handler which all other error handlers call

so in all your procedures, u have your on erro goto ...

well in that label

u can use call a function passing in err.number and err.description, also perhaps the source name (vba, form, procedure etc),
then log that and display an appropriate message

0
 
jjafferrCommented:

you would put ONE "on Error" per SUB, so it isn't a long process,
and on the error traping use,
msgbox err.number & vbcrlf & err.description

this way, all the errors will be shown

the AllowBypassKey and AllowBreakIntoCode have nothing to do with error handling
0
 
ctudorpriceAuthor Commented:
Hi,
As I understand it AllowBreakIntoCode does have some effect on error handling in that if there's an unhandled error, it at least allows Access to show the error by showing the VB code when the error occurs... no? I understand it does'nt actually "handle" the error but with it turned off, at least there is an indication of failure in the application.
Is there no way to implement a generic handler without the "on error" in every sub? The app is BIG and I don't want to have to go through a full regression test cuz I've mucked with almot every sub/function in the entire project. Yes, I know it's good practice to implement on error everywhere... blush, blush... but this thing has been with us for 8 years and about 8^8 developers with not a lot of oversight or standards.
As to where the app is failing: occasionally all over the place with things like variables being defined as integer and then the underlying SQLServer int gets too big for the VBA/Access integer. With AllowBreakIntoCode turned off and no specific error handling in the sub, Access won't do anything with the error in that the user is not notified.
If no one has a "glbal error handling" solution, is there somewhere I can get some good code for handling errors in each sub - just in case I have a few weeks spare :). Ideally an
on error go to errhandler

:errhandler
call generic_errhandler

or something - and a generic error handler that will allow users to give us details on where the error occurred and vaguely why?

0
 
jjafferrCommented:

you can use the free:
http://www.mztools.com/v3/features.htm
which can "Add Error Handler" automatically, besides other things.

jaffer
0
 
rockiroadsCommented:
Sorry, I dont think u can have a generic error handler, one per procedure I think

Im sure you are aware of the options

on error resume next, goto <label>, etc, there is also gosub, but that is only to a subroutine within a procedure



Another thing, in all your code modules, do you have

option explicit

if not, do that then try a debug/compile

0
 
jefftwilleyCommented:
Hi ctudorprice,
I have looked for a global error umbrella too and I never had any success. I decided to at least create one error handler system that I could call like you mentioned. I have one errorlog table, and each function contains an on-error call to the Error_Log function.
    'Action: "Clear" or "IsEmpty" or "Add" or "Show"
    'MessageType: "Error" or "Warning"
    'Message: Message to user
    'CorrectiveAction: .. for user to take
If you want the code I'd be glad to paste.
J
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now