Problems with the value of FormatCount

evilman

Registered User.
Local time
Yesterday, 20:19
Joined
Apr 25, 2003
Messages
31
Hi

I'm having troubles with the Format event. More specifically, one of the parameters: FormatCount.
In the Access help, it says that FormatCount will supposedly return the number of times the section has been formatted.
However, a section can be formatted 2 times, and the value of FormatCount is 1 the two times the event is triggered!

My report outputs its data to an Excel worksheet. On each Format event, the application writes a row on the Excel worksheet.
Since the Format event is sometimes called 2 times, the data is thus sometimes duplicated.

I have tried to use the Print event instead, but that only works if the report is on 1 page.

Any hints appreciated. Thanks.
 
Hi again.

You won't have to read my previous post... since I have found a "solution" to the problem (after 4 days).

It seems that when Access wants to dupe the data, it will call the "Retreat" event before.
So, I just declared a string in the report that would save the current group that will be duped.

Something like this:
Private Sub Detail_Retreat()
LastDataFooter = Me!CCSourceDesc
End Sub

Then in the Format Event:
Private Sub Detail_Format(Cancel as Boolean, FormatCount as Integer)
If (Me!CCSourceDesc <> LastDataFooter) Then 'If this row group has never been written, then we'll write the data into the Excel worksheet.
' Write the data to excel
End If
End Sub

I had to do this in the GroupFooter1 as well.
 

Users who are viewing this thread

Back
Top Bottom