Is the Output of the Program Incorrect?
Incorrect program output typically indicates a flaw within the logic of the code. To help find the error:
Set a breakpoint in the code prior to the point where the bad output is produced.
Step through the ER line by line, while monitoring the values of relevant ER variables.
At some point, a variable will probably take on an erroneous value that subsequently produces incorrect output.
If that point occurs before your breakpoint, set another breakpoint earlier in the code and restart the application.
Continue this process until you find the statement that is causing the wrong value to be assigned to the variable.