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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run-time error 20515 - formula error when VB calls Crystal Report

Status
Not open for further replies.

tj1

Programmer
Apr 18, 2001
4
US
Using VB6, CR 7.0.1.192

To speed up report, instead of summing a field (.stockrequired) in all detail rows to get grand total, I group on one field (.tray), then place a formula (in the GroupFooter section) to access the current group value (.tray) and add the number (.stockrequired) to a variable.

Formula fCarrier:
Code:
 WhilePrintingRecords;
 Global numberVar CarrierGrandTotal;
 if ToNumber (GroupName ({STOCK.TRAY})) = 100 then
    CarrierGrandTotal := CarrierGrandTotal + 
    ToNumber (Sum ({STOCK.STOCKREQUIRED}, {STOCK.TRAY}) )

I then place another formula (w/ variable above) in ReportFooter section as Grand Total.

When I preview in CR it works - and quickly (only 38 rows vs. 14,000 +) since CR performs grouping on server. However, whenever I call the report from VB I get following error:

Microsoft Visual Basic
Run-time error '20515'
Error in formula <fCarrier>.
'WhilePrintingRecords;
'
The string in [sic?] non-numeric.

I've removed the WhilePrintingRecords line from the formula, but I get the identical error w/ the 'While...' line being replaced by 'Global numberVar...' line. I can't remove the 'Global...' line because the variable must be declared.

Would appreciate any suggestions!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top