views:

187

answers:

1

I have a VB6 application using Crystal Reports XI.

After almost two years suddenly I cannot set RecordSelectionFormula anymore. The error message says, that Basic syntax is not allowed in record selection formula.

The formula is {article.id} = 1234.

I've tripple checked that formula. It works fine in the Crystal Reports designer, but even if I save that formula and change it at runtime to {article.id} = 1235 I get the same error message. Also there's no reason why this worked the whole time and suddenly not.

After googling I find that a few users have the same problem, but since Crystal Reports 11 and VB6 are somewhat antiquated, nobody seems to have solution, except updating to a newer versions of Crystal Reports or Visual Basic.

+2  A: 

Are you now running on Vista? Crystal XI has known issues with it and there's no patch. However, Crystal XI Release 2 is a free download for existing users of Crystal Reports XI and combined with the subsequent service packs should solve some issues :

http://resources.businessobjects.com/support/additional_downloads/service_packs/crxir2.asp

There is also this, extracted from a google cache of an old CR knowledge base entry :

KBase Article ID:c2018734

Article refers to:Crystal Reports XI Symptom

When a Report Designer Component (RDC) XI web or Windows application passes a record selection formula to a report at run time, the following error message appears:

"Basic syntax is not supported in group/record selection formula"

Why does this error message appear and how do you resolve it? Resolution

The error message appears after an RDC application has been upgraded from a previous version. As a result, the record selection formula is being interpreted as Basic syntax, even if it is not Basic syntax.

To resolve the error message, add these lines of code to your application so that they are executed before the record selection formula is passed to the report:

' report is the name of the 'Report' object

' sets the record selection formula to be interpreted as Crystal syntax

report.FormulaSyntax = 0 ' Use crCrystalSyntaxFormula value

CodeByMoonlight
I did no such upgrade, but setting `FormulaSyntax` to `crCrystalSyntaxFormula ` did the trick. Thank you.
DR