Today, I was debugging a problem where a group number was being changed on a row on a continuous form.
The group number was being looked up by a query and I found the spot where I thought that was happening.
By setting a breakpoint there, I was then able to examine the code and variable settings at that exact moment. The Immediate Pane in VBA not only allows you to “debug.Print” variable values and do other lookups and statements, but it also allows you to change variables in the current scope you are in. It’s like you add a line of code to execute, but it’s not put into the script, it’s just run in the Immediate Pane, but it changes the variable.
Because of this feature, I was able to first check the group number (which had been changed) and then was also able to reset the group number variable (this was a local variable in the routine) to make sure if that variable was correct, I would get the correct behavior.
When I changed the group number variable to the value I wanted in the Immediate Pane and continued execution of the rest of the code, it then worked as expected. This meant I had found the correct spot to fix.
After updating the conditional logic for this section, I was able to test again without intervening in the Immediate Pane and got the correct behavior. Awesome!