You shouldn't need to use SEEK or INDEXSEEK to solve this problem. Here's a better way to do it.
- Create a report variable called rnBoxTotal. Set the initial value to 0, set the expression to 0, set the calculate option to SUM, and define it to reset at the Group1 break.
- In the OnExit Expression of the Group2 Footer band, enter this:
_vfp.SetVar('rnBoxTotal', rnBoxTotal + (gqty / perbox))
What this does is create a report variable that is zero, and since it is marked as SUM, it just adds zero to itself for every detail record. So far .. you have zero. The expresion in the OnExit of the Group2 Footer band will add the box count for that group to the report variable. Because the report variable is defined to just add zero to itself for each detail record, you don't have to worry about it destroying the value you just added to it. When you get to the Group1 Footer ... use rnBoxTotal for the box count. It will then reset itself for the next Group1.