Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    securitywyrm is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    97

    How can I make Access not show error messages?

    I'm currently developing a database that, due to some factors beyond my control, can generate errors. For example I have a dropdown of program names, and then a button to go to that program display page. If someone hits the button without a selection, it pops up the error menu. I do NOT want users able to go into the debug configuration, they WILL try to 'fix it themselves', break stuff, and then blame me.



    I've had a difficult time finding guides on error handling. I'd rather have it just 'do nothing' than pop up the error when one occurs. How can I make this happen?

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You definitely need to handle errors. For instance, the one mentioned in your post can be a message that pops up saying "please select a program". But if you don't handle errors then they will send the user to where you don't want them to go.

  3. #3
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    Sometimes its an error you want to trap, sometimes it's validation (so that you don't end up passing Null to a query or something). As a general rule, each procedure should have error handling, and for button clicks, often validation is a good idea. Otherwise Access goes back up stream to look for an error handling routine. If one isn't found, the default error handler will take over. If one is found but doesn't handle the error, same thing.

    You could consider having an error handling procedure in a standard module just to build a message box since it's such a repetitive piece of code. For error trapping, you either have to know all the possible errors that could occur due to a user interacting with a form (and who knows them all?) or try doing the unexpected and raising the error, then trapping for that error number. When it comes to validation, you click the button with "dog" in a control where a number should be and either see what happens, or just trap that and don't allow it. That's validation. For that, it's often more efficient to loop through a set of controls, for example, to ensure none are blank.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,130
    Agree completely with aytee.
    Do NOT try & prevent error messages or at some stage you will have a totally corrupted and unusable database

    What you should be doing is adding error trapping to EVERY procedure in your project.
    For the developer, this should provide full details of the error

    However for other users, you could show a 'special form' frmErrorMessage that doesn't allow access to debugging.
    This could tell them an error has occurred and ask them to contact e.g. the system admin

    Combining, it would be something like this

    Code:
    Private Sub MyProcedureName()
    
    On Error GoTo Err_Handler
        
        ..... your code here
          
    Exit_Handler:
        Exit Sub
    
    
    Err_Handler:
        If ProgramAdminStatus=True Then
                MsgBox "Error " & Err.Number & " in MyProcedureName :             " & _
                      Err.Description, vbCritical, "Program error"
        Else
                DoCmd.OpenForm "frmErrorMessage"
        End if
        Resume Exit_Handler
    
    
    End Sub
    Of course, most users won't bother to pass on info about the error so it won't get fixed
    If you want to go the next step, have the code automatically send an email with full details of the error to you as the developer - who/what/where/when/error number /description.

    I did that in one of my very large apps - it took me a couple of months of coding to complete.
    It worked brilliantly - I had an initial flurry of emails of errors that had been in place for a long time but I wasn't aware of.
    After fixing those, the errors stopped completely - job done!
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    some factors beyond my control, can generate errors.
    As others have advised, you really need to handle errors. If people can "go" to areas where they should not go, then your program logic should ensure that they can not go there. When you create/develop a program, you know what the proper path is or should be; and can set up a message (or other construct) to keep people on the path you want them to follow.

    Not showing an error message is not a complete (nor advisable) solution.
    Analysis and design is required, and can not be stressed too much.
    Getting the proper logic flow is a key factor in making a usable/friendly application.
    This often requires many tests and feedback iterations.

    To get some ideas you may want to review these verification and validation routines.

    General approach:

    Code:
    If some condition(s) are met then
       Do what you have designed
    Else
       Send a Msg that user has failed a condition
       then send him/her back to redo the condition
    End
    Good luck

  6. #6
    securitywyrm is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    97
    I agree with what everyone is saying here, that every error should be displayed and handled, not hidden away. If I didn't have to deliver a 'ready to use' database in 16 hours I would be glad to setup error handling on every situation. I also have no formal training in access and everything I know has been from frantic studying of specific tasks to complete, like learning how to lance a cyst without learning anything else about dermatology.

    Fortunately data corruption isn't an issue, because the forms I need to 'block errors' is one that is read-only. I need to 'lock down' this file as much as possible because they will find creative ways to break it and blame me for the breakage.

    So please, how do I make it so that if an error message would otherwise appear, it just fails the task and doesn't show an error?

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    Databases deal with some sort of "business" (no matter how much you may have to abstract it).

    What kind of organization charges someone with no formal training to build an operational database in 16 hours??

    What is the business? What are the subjects involved?
    What are the business processes involved? What are the business rules?

    Tell us about a day in the life of "your business goes here".

  8. #8
    Micron is offline Very Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,372
    I do NOT want users able to go into the debug configuration
    I forgot about that part. The option to handle errors needs to be set to suit your situation. If you set it to break on all errors, that's what will happen.

  9. #9
    securitywyrm is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    97
    Quote Originally Posted by orange View Post
    Databases deal with some sort of "business" (no matter how much you may have to abstract it).

    What kind of organization charges someone with no formal training to build an operational database in 16 hours??

    What is the business? What are the subjects involved?
    What are the business processes involved? What are the business rules?

    Tell us about a day in the life of "your business goes here".
    I'm a federal bureaucrat, developing a contacts database for a hospital for its residency program.

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    I'm currently developing a database
    Contact same as applicant? One hospital or many? Any specialty on residency program(s)?
    Show us your tables and relationships as a jpg or png.

    Or post a copy of what you have --remove confidential info first and post in zip format.
    You can use names like Porky Pig, Daffy Duck,etc to anonymize anything personal.
    Readers could use sample structures to assist in focused responses. We do NOT need real info--just some representation/mock up.

    Good luck.

  11. #11
    securitywyrm is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    97
    Quote Originally Posted by orange View Post
    Contact same as applicant? One hospital or many? Any specialty on residency program(s)?
    Show us your tables and relationships as a jpg or png.
    No. I'm not looking to fix every possible error RIGHT NOW because I DON'T HAVE TIME. I just want to know what I need to put into the visual basic to say "On error, fail and don't show error." Why the hell are you demanding to know the details of my job? No, we're not hiring.

  12. #12
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850

  13. #13
    securitywyrm is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    97
    Quote Originally Posted by orange View Post
    Do what ridders advised in post #4.

    Good luck.
    The issue with that solution is that I need to apply an error handler to every single button, dropdown, etc. Is there a 'master' function somewhere, where I can have it do a particular thing for ALL errors?

  14. #14
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    No - no generalized error function as such.
    Micron's suggestion of a standard module is closest, but there would be no details in the message unless you had a list of possible errors.
    With such a list you could pass an error number or message text, but that also requires design.

  15. #15
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,130
    Quote Originally Posted by securitywyrm View Post
    The issue with that solution is that I need to apply an error handler to every single button, dropdown, etc. Is there a 'master' function somewhere, where I can have it do a particular thing for ALL errors?

    Do you really think that I would have spent over 2 months doing something if a ready made solution was available?

    And a word of advice, following on from your comment in post 11
    Why the hell are you demanding to know the details of my job? No, we're not hiring.
    Questions like that are done to help us help you - not because we are nosy
    If you respond in that way, you reduce your chances of getting assistance
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Error Messages On Subforms, Access 2016
    By roxdrob in forum Forms
    Replies: 19
    Last Post: 10-07-2017, 11:40 PM
  2. Error messages
    By Lou_Reed in forum Access
    Replies: 8
    Last Post: 12-08-2016, 11:34 PM
  3. How to handle error messages?
    By yes sir in forum Access
    Replies: 3
    Last Post: 10-15-2011, 11:22 AM
  4. Custom messages to Access' default error messages.
    By evander in forum Programming
    Replies: 1
    Last Post: 06-26-2010, 02:06 AM
  5. Error Messages
    By DataGeek in forum Access
    Replies: 0
    Last Post: 12-06-2007, 09:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums