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

ERROR 20515 IN VB. HEEEELLLLP 1

Status
Not open for further replies.

slim2

Programmer
Oct 18, 2001
94
Error in formula <AmtYldArray>,
'WhilePrintingRecords;
'
The remaining text does not appear to be part of the formula.

Can anyone tell me how i can find out what the error is. There are many other statements in this formula, and it works fine when running in Crystal.
 
Additonal info. I am running VB 6 and Crystal 8.5. I have also searched Crystal knowledge base and nothing applied.
No parameters are being passed. it is a simple execute of the rpt.

Thanks
 
An error like that usually does not point to where the error is. You probably go a misplaced semicolon, bracket or quote amrk, and CR isn't smart enough to tell you exactly what it was that you really wanted to do.

Can you post the entire formula and we might be able to spot the real cause of the error. Editor and Publisher of Crystal Clear
 
Thanks, here it is

WhilePrintingRecords;
Global NumberVar Array AvgYldPrt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array TrmYldPrt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array TrmYldChPrt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array AvgYldChPrt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array TotChPrtDol := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array TotChPrtCnt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array NewChPrtDol := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array NewChPrtCnt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array NonChPrtDol := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array NonChPrtCnt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array TotLnDol;
Global NumberVar Array TotLnCnt;
Global NumberVar Array NewLnDol;
Global NumberVar Array NewLnCnt;
Global NumberVar Array NonAcDol;
Global NumberVar Array NonAcCnt;
Global numberVar Array AvgYld;
Global numberVar Array TrmYld;
NumberVar I;
NumberVar I2 := 2;
For I := 1 to 13 Do
(
If TotLnDol <> 0 Then AvgYldPrt := AvgYld/TotLnDol;
If TotLnDol <> 0 Then TrmYldPrt := TrmYld/TotLnDol;
);
//
If AvgYldPrt[1] <> 0 Then AvgYldChPrt[1] := (AvgYldPrt[1] - AvgYldPrt[13])/AvgYldPrt[1];
If TrmYldPrt[1] <> 0 Then TrmYldChPrt[1] := (TrmYldPrt[1] - TrmYldPrt[13])/TrmYldPrt[1];
If TotLnDol[1] <> 0 Then TotChPrtDol[1] := (TotLnDol[1] - TotLnDol[13])/TotLnDol[1];
If TotLnCnt[1] <> 0 Then TotChPrtCnt[1] := (TotLnCnt[1] - TotLnCnt[13])/TotLnCnt[1];
If NewLnDol[1] <> 0 Then NewChPrtDol[1] := (NewLnDol[1] - NewLnDol[13])/NewLnDol[1];
If NewLnCnt[1] <> 0 Then NewChPrtCnt[1] := (NewLnCnt[1] - NewLnCnt[13])/NewLnCnt[1];
If NonAcDol[1] <> 0 Then NonChPrtDol[1] := (NonAcDol[1] - NonAcDol[13])/NonAcDol[1];
If NonAcCnt[1] <> 0 Then NonChPrtCnt[1] := (NonAcCnt[1] - NonAcCnt[13])/NonAcCnt[1];
//
For I := 1 to 11 Do
(
If AvgYldPrt[I2] <> 0 Then AvgYldChPrt[I2] := (AvgYldPrt[I2] - AvgYldPrt)/AvgYldPrt[I2];
If TrmYldPrt[I2] <> 0 Then TrmYldChPrt[I2] := (TrmYldPrt[I2] - TrmYldPrt)/TrmYldPrt[I2];
If TotLnDol[I2] <> 0 Then TotChPrtDol[I2] := (TotLnDol[I2] - TotLnDol)/TotLnDol[I2];
If TotLnCnt[I2] <> 0 Then TotChPrtCnt[I2] := (TotLnCnt[I2] - TotLnCnt)/TotLnCnt[I2];
If NewLnDol[I2] <> 0 Then NewChPrtDol[I2] := (NewLnDol[I2] - NewLnDol)/NewLnDol[I2];
If NewLnCnt[I2] <> 0 Then NewChPrtCnt[I2] := (NewLnCnt[I2] - NewLnCnt)/NewLnCnt[I2];
I2 := I2 + 1;);
 
In the first for loop you have unsubscripted global arrays.

The error you're describing is usually - in my experience - caused by too many or too few semicolons.

Tell us how you get on

D. &quot;I want to play...&quot;
(Guess the episode!)
 
deetee2k,

Great spot! I looked over that formula several times line by line and did not spot it. I have fixed it, unfortunately the VB error still exists. I cannot understand why it works in Crystal but not Vb. Is there any way to detemine where the problem lies.

Thanks again
 
I do not think that this is a VB error, it is an error that pops up in Crystal.
Check your initialise function or if you don't have one create it, slap it into the report header (so it'll only be evaluated once) and insert all initialisation of global variables in there. i.e.

//in @initialise
Global NumberVar Array AvgYldPrt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array TrmYldPrt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array TrmYldChPrt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array AvgYldChPrt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array TotChPrtDol := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array TotChPrtCnt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array NewChPrtDol := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array NewChPrtCnt := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array NonChPrtDol := [0,0,0,0,0,0,0,0,0,0,0,0,0];
Global NumberVar Array NonChPrtCnt := [0,0,0,0,0,0,0,0,0,0,0,0,0];

then in @YldAmtArray declare as follows,

WhilePrintingRecords;
Global NumberVar Array AvgYldPrt;
Global NumberVar Array TrmYldPrt;
Global NumberVar Array TrmYldChPrt;
Global NumberVar Array AvgYldChPrt;
Global NumberVar Array TotChPrtDol;
Global NumberVar Array TotChPrtCnt;
Global NumberVar Array NewChPrtDol;
Global NumberVar Array NewChPrtCnt;
Global NumberVar Array NonChPrtDol;
Global NumberVar Array NonChPrtCnt;

HTH, sorry can't be of more help but I'm pretty sure the error your getting lies in Crystal and not in VB...(famous last words)

D. &quot;I want to play...&quot;
(Guess the episode!)
 
Thanks again for your reply. This formula is run once at the group break and is in the groupa footer. It calculates values based on the values developed in detail but printed in footerb.

Thanks again for responding. If I stumble onto it I'll post the answer.

 
Continuing on with DeeTee2K thoughts....the last loop

&quot;For I := 1 to 11 Do
(
If AvgYldPrt[I2] <> 0 Then AvgYldChPrt[I2] := (AvgYldPrt[I2] - AvgYldPrt)/AvgYldPrt[I2];
&quot;

This loop uses I2...not I


Jim


 
Jim,

Thanks for the reply, I appreciate you lokking at it, I set the I2 at the top of the formula.

It runs fine in Crystal and only fails when executed through Vb, it is driving me nuts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top