Results 1 to 7 of 7
  1. #1
    AndycompanyZ is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    80

    On error go to advice needed


    I am going to deploy my database soon and read somehwere about errors in the vba and that all code should have on error go to in the code. Do I need to wrap every sub routine in this.
    Last edited by AndycompanyZ; 06-24-2011 at 03:40 AM. Reason: grammar

  2. #2
    Rod is offline Expert
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Yes, especially as you are about to deploy.

    Microsoft run time error messages are not always the best or most informative and your users deserve better. Actually, nearer the truth is that you need to assist your users in reporting the error.

    You should design an error handler that wraps the MS message in a more user-friendly interface and tell your users what to do when they encounter it. This is probably an instruction to get in touch with you and quote the following information ...

    An error handler also gives you a chance to programmatically protect the integrity of your data.

  3. #3
    AndycompanyZ is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    80
    Thanks just need to look up how to do that

  4. #4
    Rod is offline Expert
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    OK, in anticipation of your next question: no I don't always follow my own advice. When I have an event handler of one or two lines such as:

    basFileManager.AddRecord

    what can possibly go wrong? Well I suppose the basFileManager module could be missing or the AddRecord procedure corrupted. How likely is that? I don't bother wrapping such as this in On Error code.

  5. #5
    AndycompanyZ is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    80
    OK thanks maybe to be safe I'll just wraqp everything there's not that much code behind

  6. #6
    Rod is offline Expert
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Write one error handling procedure and call it in the target code referenced by On Error GoTo

    Remember to include statements to

    Turn echo on
    Display standard cursor
    Revert to defaults any other GUI propereties you may have altered.

  7. #7
    AndycompanyZ is offline Advanced Beginner
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    80
    Thanks will do. I'm sure I'll be back when I run into problems though as its the first time I've actually deployed

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Database advice
    By PRINCE SWAGG in forum Access
    Replies: 29
    Last Post: 06-21-2011, 03:56 PM
  2. Security Advice
    By jpkeller55 in forum Access
    Replies: 6
    Last Post: 02-18-2011, 08:22 AM
  3. design advice
    By Sarge, USMC in forum Database Design
    Replies: 4
    Last Post: 10-06-2010, 07:53 AM
  4. Form sizing advice needed
    By DanW in forum Forms
    Replies: 0
    Last Post: 11-15-2009, 09:35 PM
  5. Need advice on what I have so far
    By rumplestiltskin in forum Database Design
    Replies: 2
    Last Post: 05-25-2006, 12:48 PM

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