Using running sum as a field in a calculation

Bumpkin

Registered User.
Local time
Today, 08:22
Joined
May 31, 2015
Messages
16
I have a report that lists scores for archers using different bow types. The report groups by bow type and sorts by score. I have added a field named "LineNo" =1 and summed over groups, this gives the position of each archer within the group.
I now want to divide the groups into teams, two archers per team for bow types "Longbow" and "Barebow" and three archers per team for "Compound" and "Recurve".

The result I want is a field in the report printing teams as 1.1, 1.2 2.1, 2.2, 3.1,3.2 etc. for Longbow/Barebow and 1.1, 1.2, 1.3, 2.1, 2.2, 2.3, 3.1, 3.2, 3.3 etc for Compound/Recurve

I have added calculated field to the report called Teams. The calculation is quite complex but is the simplest way I could think of :
"=IIf([bow]="Recurve" Or [bow]="Compound",Int(([LineNo]-0.0001)/3)+1+([LineNo]-(Int(([lineno]-0.0001)/3))*3)/10,
Int(([LineNo]-0.0001)/2)+1+([LineNo]-(Int(([lineno]-0.0001)/2))*2)/10)"

This works fine in Design mode as can be seen in the attached report "Correct Print" but when I save it and try again the calculated field is corrupted as per the attached file "Corrupt print".

Where am I going wrong as it seems work fine until I close the database and reopen it?
 

Attachments

in design view, try to increase the Width of "Team" column.
or add formatting to the column using 0.0
 
in design view, try to increase the Width of "Team" column.
or add formatting to the column using 0.0
Thanks for the suggestion but that was the first thing I tried, the result was the field filled with "Name???".
The really wierd thing is I have tried again today without changing anything, including the data. I selected the datbase file, opened it, tried the report and exited repeatedly. It gave the corrupt report first time but was absolutely fine the next 5 times.
I can't really say it is solved as I still have no idea what the problem is/was.
 

Users who are viewing this thread

Back
Top Bottom