Identifying String Issues in Visual Basic Links to the Crystal Report Engine
When passing a string to the Crystal Report Engine as part of the Custom-Print Link, you may think that you are passing one thing when the program, in fact, is passing something entirely different. This can happen easily, for example, when you are passing a concatenated string that you have built using variables. A small syntax error (with embedded quotes, for example) can lead to an error message and a failed call. A simple debugging procedure follows.
To Identify a String Issue (bug)
To identify a string bug, have the program display what it is passing in a message box. To do so, put a line of code similar to the following immediately after the call in question:
MsgBox (variablename)
Look at the string that is displayed and make certain that it is exactly what Crystal Reports expects for a string.
- If the syntax is incorrect, look for errors in the concatenated string you have built.
- If the syntax is correct, look for other problems that could have caused the call to fail.
- If you are not sure if the syntax is correct, write down the string from the message box, enter it in the Crystal Reports Formula Editor, and click the Check button. If there is an error in the string, the Formula Checker will identify it for you.