Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RecordSelectionFormula

Status
Not open for further replies.

JBats

Programmer
Aug 3, 2003
127
PH
Hi Guys,

I'm having a problem executing my program in VB6 using Crystal Report 11. I tried executing this code below in my program and an error occurred "Basic Syntax is not supported in group or record selection formula".

Set CrystalReport = crApp.OpenReport("c:\Program\ra.rpt")
CrystalReport.RecordSelectionFormula = "{t_batch_ra_Header.AgencyCode} = 1 and {t_batch_ra_Header.batchnumber} = 731"

When you first run the program this statement works and the report was displayed correctly but when you tried executing it for the second time, an error described above occurred.

Any help would be highly appreciated.

Thanks,
Jbats

JBats
Good is not better if not than best...
 
Try putting {t_batch_ra_Header.AgencyCode} = 1 and {t_batch_ra_Header.batchnumber} = 731 in the record selection.

Also try creating a test report using the 'Wizard', to get an example of how Crystal normally does things. There is a lot it does for you, whether or not you want it to.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
I would assume that 1 and 731 are dynamic values

have a look at the options available on your CrystalReport object

and see if there is a refresh or reset option

eg.
CrystalReport..RefreshReport
and place it before or after your

CrystalReport.RecordSelectionFormula = "{t_batch_ra_Header.AgencyCode} = 1 and {t_batch_ra_Header.batchnumber} = 731"


Mo
 
Thank you guys for sharing your ideas. I tried what Madawc suggested by putting the statement inside the recordselectionformula of the rpt file and it works ok but my problem is when i'm going to change the value of agencycode and batchnumber.

Yes your right MisterMo that this number are dynamic so it can be changed depending on the input of the user.

JBats
Good is not better if not than best...
 
Was there resolution to this issue? I'm encountering this error just as described. The formula works fine when copied into the record selection formula for the CR, but going through VB6, it works the first time, but errors the second time.
 
I just upgraded from version 10 to 11, and I'm having the same problem (Basic syntax is not supported in group or record selection formula.) - but for me it's happening only the first time I try to run the report, it seems to work fine after that...

Here's the code that's generating the error:
PickReport.RecordSelectionFormula = "{ENG_PICK_LIST.head_order_nbr} = '" & sOrder & "' and {line_dtl.head_order_nbr} = '" & sOrder & "'"

Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top