"On Format" event for my Detail report sections triggers multiple times

N

NU_Dave

I know that is what the FormatCount parameter is for, but I set up;
debug.print ID & ": " & FormatCount
in the procedure that I've written, and I'm seeing the same ID repeatedly
with FormatCount = 1.

Yes - I'm positive that every row being read by the report has a unique ID.

I set up a test database with only one table, one report, and one procedure
(On Format) to check this out and it is happening in there as well.

Suggestions appreciated....

Dave
 
N

NU_Dave

Thanks Marshall -

What I'm doing involves writing a row to a table for every detail record in
the report. I've was hopeful about "FormatCount" given the documentation
provided, but then frustrated when there were multiple "first" formats for
each record.

As a workaround I'm just allowing it to write out duplicate records, then
doing "group by" in the query that later reads that table to eliminate
duplicates.

I just hate workarounds and was hoping that I was missing something
simple...

Thanks!

Dave
 
M

Marshall Barton

NU_Dave said:
I know that is what the FormatCount parameter is for, but I set up;
debug.print ID & ": " & FormatCount
in the procedure that I've written, and I'm seeing the same ID repeatedly
with FormatCount = 1.

Yes - I'm positive that every row being read by the report has a unique ID.

I set up a test database with only one table, one report, and one procedure
(On Format) to check this out and it is happening in there as well.


The FormatCount (and PrintCount) values are not anywhere
near that simple and in general are not useful.

What you are seeing is probably normal as section
KeepTogether, CanGrow/CanShring, group KeepTogether and who
knows what else interact to produce a report.

If you are trying to use code to calculate a value from
multiple detail records, then forget it and either do the
calculation in the report's record source query or use text
box expressions with RunningSum.
 
M

Marshall Barton

That is a workaround and not a particularly good one.
Report are an inappropriate mechanism

The "correct" way to do that kind of thing is to use an
append query based on the report's record source query. I
could be done in the report's Close event, but IMO, should
be a separate operation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top