In this step, you will learn how to set breakpoints in a form. A breakpoint is the line of code where the form will stop execution so that you can review the code or variables. You will add a breakpoint at the beginning of the UPDATE button click event, before any data is written to the table.
1. Scroll down to the event handling routine to UPDATE.Click
Note: You can rapidly move to any routine in your code, by using the Go To tab. Expand routines and double click on a routine to move to that line in the editor.
2. Press the F9 key to set a breakpoint on this line. The line is highlighted in red.
Note: You can set break points both before executing Debug or while running in Debug mode. Breakpoints are remembered in both cases (they are saved when you close the form in the editor).
3. Press F5 to continue executing the form. Enter 1000 as the department code and click the Fetch button. The form will display the Internal Audit department. Leave the value of the Department Description as it is and click the Update button. When the form reaches the breakpoint, source code will be redisplayed, with the breakpoint line highlighted in yellow.
4. Display the Breakpoints tab. The new breakpoint will be listed as follows:
The program will now stop before executing this line of code. This will allow you to view and change the variables or make other changes to debug settings.
5. Scroll to the top of the code and set the focus on the GROUP_BY command and press F9. Notice that this command is not highlighted. You can only set breakpoints on executed lines of code. The GROUP_BY is a definition statement, used for compilation and is not used at execution time.
6. Press the F5 key to execute the application until the next breakpoint. Since there are currently no more breakpoints, the UPDATE will be processed and the form redisplayed.