LarryDeLaruelle
Technical User
I just encountered a strange behaviour in Access.
I created a sub report to display names and positions. In the general declarations I dimmed integer variables to hold the count of positions.
In the Detail Section's On_Format event I have a Select Case statement to increment the counters based on the value held in the field 'Position'.
I put unbound text controls in the Report Footer and in the Footer's On_Format event I assign the values of the counters to the appropriate control.
All this works just fine.
I then created an unbound report and placed the sub report in the detail section. Now, when I run this unbound report all values in the sub-form counters are doubled.
I put a break point at the beginning of the Select Case statement and discovered that this code is processing twice. My guess (uneducated at best) is that the subform's On_Format event is being invoked twice -- once from the main form's On_Open (?) and once from the sub-form's On_format(?).
I did a work-around by simply dividing the final result in the sub-form's controls by two. Not elegant but it works.
Any ideas on why this is happening and how I can implement a better solution to this?
As always, I appreciate your help. Thank.s
Larry De Laruelle
larry1de@yahoo.com
I created a sub report to display names and positions. In the general declarations I dimmed integer variables to hold the count of positions.
In the Detail Section's On_Format event I have a Select Case statement to increment the counters based on the value held in the field 'Position'.
I put unbound text controls in the Report Footer and in the Footer's On_Format event I assign the values of the counters to the appropriate control.
All this works just fine.
I then created an unbound report and placed the sub report in the detail section. Now, when I run this unbound report all values in the sub-form counters are doubled.
I put a break point at the beginning of the Select Case statement and discovered that this code is processing twice. My guess (uneducated at best) is that the subform's On_Format event is being invoked twice -- once from the main form's On_Open (?) and once from the sub-form's On_format(?).
I did a work-around by simply dividing the final result in the sub-form's controls by two. Not elegant but it works.
Any ideas on why this is happening and how I can implement a better solution to this?
As always, I appreciate your help. Thank.s
Larry De Laruelle
larry1de@yahoo.com