View Full Version : VBA Counter adding 1 again on new page


geraldcor
05-02-2008, 02:37 PM
Hello all,

I have a report where I am counting based on certain criteria in the form of
If such and such = this then
counter = counter + 1
Elseif....
End If

The counter works fine up until I hit a new page. The counter counts once, goes to the new page and then counts again. So for each page of the report, the counter is inflated by 1. I am doing it this way because I have 5 different things I am counting. The counter code is in the detail and the variables are integers declared in the Option Compare Database section (global). I have had nothing but grief with counters on Access reports.

Does anyone know why it is adding one and if so how to remedy this? Thanks

Greg

pbaldy
05-02-2008, 03:05 PM
Look at the Retreat event in VBA help for an explanation of the problem.

geraldcor
05-02-2008, 03:29 PM
Oh Good Grief! Ok. Thanks. I guess I will have to do yet another hack to get access to do what I want.

Thank you for the reply

Greg

odin1701
05-02-2008, 03:54 PM
AGH! I had this problem at one point, and I didn't know about the Retreat event.

I do now though, cool :)

I ended up getting around the issue in another way...but it was more complex than needed.

pbaldy
05-02-2008, 03:56 PM
LOL, no problem.