Now that explains it. Indeed I set 0 as value to store. So that makes sense, thanks again.
>The code in the form is unnecessary. You defined report variable incorrectly. It would work if you put the variable name in the Value to store. Otherwise it gets reset to 0 each time.
>
>>I debugged the variable by displaying the value in a report field.
>>If I put the code into the On Exit of the group, the value is always 0.
>>If I put the code into the ON ENTRY of the group, the value is always 1.
>>
>>So my guess is that the variable is reset each time when entering the group, or there must be something wrong with the _VFP.SetVar() method that it always creates the variable. In the variable declaration I select Reset at end of report so this cannot be it.
>>
>>I solved the problem by creating a form property for the count, and I also created my own "SetVar" method in the form that calls the report. In the On Entry of the band I issue THISFORM.DoCount() and I have a property on the form THISFORM.nCounter that I use for the display of the shape. The DoCount() method does the following:
>>
>>THISFORM.nCounter = THISFORM.nCounter + 1
>>
>>Before running the report I set THISFORM.nCounter = 0 and that is working now.
>>
>>Thanks anyway to both of you for your help in this, sometimes it just takes some sleep to get to a solution.
>>
Christian Isberner
Software Consultant