VBA code in footer runs twice

Goldar

New member
Local time
Today, 13:17
Joined
Jul 22, 2009
Messages
5
I have a report that has a Detail section, a Group footer section and a Report footer section. The Group footer is based on a field named [Quarter] and it's code should be executed once for each value of this field. My problem is that it is being executed twice for each value of this field, and doubling totals that I am accumulating.

I tracked the execution through this code and it executes when [Quarter]=1 and again when [Quarter]=2. If it would stop then, it would be fine. But, continues on to repeat the same sequence again. Why is this happening? I realize that this might be a programming problem, but I don't know where to look. I am sure that the input data (as specified by the form.recordsource parameter) is sequenced correctly.

Thanks...
 
probably because a report gets processed twice - once to paginate etc, then again to actually print

can't you get the report total by summing fields in the query, rather than trying to compute a running sum.

or set a flag after the first process to say its been calculated


this sort of thing

if not calcdone then
docalc
calcdone=true
end if
 

Users who are viewing this thread

Back
Top Bottom