98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsPrevious article Next article Access articles
Access VBA Handling Errors and Debugging Code
Mon 4th February 2008
Learning the principles of error handling is another particularly important goal for students of Access VBA. A major difference between an amateur and a professionally developed Microsoft Access application is its' ability to deal with problems. Access implements VBA error handling at procedure level. By adding VBA error handling code to your MS Access applications, it is possible to prevent crashes and error messages.
In simple terms, when programmers write code they should be able to anticipate as many problems as possible and attempt to deal with these problems early on. This means coding for error conditions that may arise when your database is running.
There are three main types of problems:
Syntax or user data entry errors arise from the inclusion of mistyped words or incorrect expressions in your code.
Run-time errors are problems faced by users when interacting with your database because the programming environment cannot correctly execute a program statement.
Logic errors are undeclared errors that prevent your code from compiling. These tend to be vague and difficult to fix.
Debugging is another important skill for a developer, especially as code gets more complex. MS Access has been designed to include powerful debugging tools which do not work on built-in macros. To debug code you need to run your code line by line to see what is happening. The next step is to construct a subroutine which calls the function. You need to set a breakpoint inside the function which is a selected line of code that, once reached, will cause your program to become suspended. Then you can use the VBA debugging environment to view the status of your program, step through each successive line of code, continue or halt execution of the code. Other debugging tools include the immediate window and the watch window.
By attending an Access VBA course, it is possible for you to master these and other concepts and ultimately, help you to build more complex databases.
Author is a freelance copywriter. For more information on access vba courses, please visit https://www.stl-training.co.uk
Original article appears here:
https://www.stl-training.co.uk/article-287-access-vba-handling-errors-and-debugging-code.html
London's widest choice in
dates, venues, and prices
Public Schedule:
On-site / Closed company:
TestimonialsMitsubishi UFG Trust International Limited
Associate Director George Mavrokordatos Introduction to Management Thank you to STL and Tony for a very comfortable, productive and useful two days of training which has already added value to me as a manager Prudential Plc C/o Corporate Property
Senior Administrator Contract Office Liz Buckland Excel Intermediate Very good trainer, judged the level of knowledge in the class very well and worked with us each individually when extra help was required. Was very good at relating the course content with day to day work scenarios. Imperial War Museum
Retail & Admissions Systems Manager Excel VBA Intro Intermediate Both STL courses I've attended have given me a better understanding, and have helped by putting things into a useful context. |
PUBLICATION GUIDELINES