Compiling Your Procedures

The VBA code you write in the Visual Basic Editor's Code window is automatically compiled by Microsoft Access before you run it. The syntax of your VBA statements is first thoroughly checked for errors and then your procedures are converted into executable format. If an error is discovered during the compilation process, Access stops compiling and displays an error message. It also highlights the line of code that contains the error. The compiling process can take from a few seconds to a few minutes or longer, depending on the number of procedures written and the number of modules used.

To ensure that your procedures have been compiled, you can explicitly compile them by choosing Debug | Compile in the Visual Basic Editor window.

Microsoft Access saves all the code in your database in its compiled form. Compiled code runs more quickly when you open it in the future. Remember to always save your modules after you compile them. In Chapter 9 you will learn how to test and troubleshoot your procedures. Refer to this chapter often as you write the procedures demonstrated in this book.

As a final note for this chapter, choose Debug | Compile to compile the event procedures you've written in this chapter.

0 0

Post a comment