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

Problems with global variables

Status
Not open for further replies.

flepkows

Programmer
Jun 7, 2004
17
US
Hello All, I have a report in which I have to formulas. One formula is within the details section:

Global DateVar array Names;

WhileReadingRecords;
Redim Preserve Names[UBound(Names) + 1];
Names[UBound(Names)] := Date({Timeline.TransitionDate});

and it just adds a date value to the array for each item in each group.

My second formula is placed in the group footer:


Global DateVar array Names;
NumberVar array buffer;
NumberVar temp;
NumberVar i := 1;
NumberVar k := 1;
NumberVar j := 1;
NumberVar p := 1;


for i := 1 to UBound (Names) step 1 do
(
Redim Preserve buffer[UBound(buffer) + 1];
buffer[UBound(buffer)] = (DateDiff ("s",DateTime(Names) , CurrentDate ));
);

Everytime I attempt to display this report I am given an array that a subscript must be between 1 and the size of the array. The line in the group footer formula that accesses the Names array is causing the problem. For some reason I do not think the Names array is getting values added to it in the details section or the Names array is not getting properly shared between the formulas. Any help or ideas would be great, I am at a loss to solve the problem.

Frank
 
You're going to kick yourself. I pasted your formulas and and got the same error. So if you are using the second formula exactly as it appears, all you need to do is add a

WhilePrintingRecords;



Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top