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.
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
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.
Thanks just need to look up how to do that
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.
OK thanks maybe to be safe I'll just wraqp everything there's not that much code behind
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.
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