Debugging the Addin

The Error List pane (mentioned in the previous section) helps you to locate any errors in your code; you can double-click an item to go to the line of code that caused the error. When working with an add-in, you can use the "Start Debugging" selection on the Debug menu to step through the code — but first you have to select Access as the application to start when debugging. To do this, select "CreateObjects Properties" from the bottom of the Project menu (if you are working with a different project, its name appears instead of CreateObjects). Click the Debug tab and select Access as the "Start external program" option selection. (Figure 16.24 shows the Select File dialog that appears when you click the Browse button to the right of the "Start external program" option.)

Now you can set breakpoints in your code (using the F9 function key), as with Access VBA, and when you select Start Debugging on the Debug menu, Access will open automatically. Select (or create) a new database, and then click the add-in's buttons to run and debug the code; it will stop at the breakpoints you have set so you can step through the code with the F8 function key.

Selecting Access as the program to start when debugging.

Selecting Access as the program to start when debugging.

0 0

Post a comment