AndrewMozley
Programmer
An application allows the user to modify a report layout (within reason). The user may provide his own (.frx/frt) report layout, or he may modify the report layout, via the MODIFY REPORT command.
If there are errors in the report layout, they need to be reported back to the user. To that end, part of the sequence of instructions is - broadly --
Variable Thisform.sReport contains the name of the report being modified.
An error is then created in the report layout: perhaps specifying that the value of a field is ABCD rather than “ABCD”.
When this code is running in the development environment, and the user asks for ‘Report Preview’ the error is trapped in the CATCH clause, and (among other things) the value of loError.message is “Variable ‘ABCD’ is not found”. This is helpful.
However, if the same report and preview is being run as part of an .exe file, not in the development environment, the error is detected, but the value of loError.message is “Syntax error”. Still a true message, but not so helpful.
I would like to know why this is. The same difference between messages happens if the error is trapped by the routine called from an ON ERROR statement. Is there a way of ensuring that the more descriptive error message can be displayed when the layout error is detected when running the .exe program?
Thanks. Andrew
If there are errors in the report layout, they need to be reported back to the user. To that end, part of the sequence of instructions is - broadly --
Variable Thisform.sReport contains the name of the report being modified.
Code:
TRY
MODIFY REPORT .sReport
CATCH TO loError
. . . .
ENDTRY
An error is then created in the report layout: perhaps specifying that the value of a field is ABCD rather than “ABCD”.
When this code is running in the development environment, and the user asks for ‘Report Preview’ the error is trapped in the CATCH clause, and (among other things) the value of loError.message is “Variable ‘ABCD’ is not found”. This is helpful.
However, if the same report and preview is being run as part of an .exe file, not in the development environment, the error is detected, but the value of loError.message is “Syntax error”. Still a true message, but not so helpful.
I would like to know why this is. The same difference between messages happens if the error is trapped by the routine called from an ON ERROR statement. Is there a way of ensuring that the more descriptive error message can be displayed when the layout error is detected when running the .exe program?
Thanks. Andrew