My code works fine in both of these.
Thanks
---------------
Luke Bellamy
Newcastle, Australia
Once Access has a solution for the record, the section's Print event fires
when the record is actually placed on the page. This event is too late to
add text that may need extra/less space (to shrink or grow), because that's
already been calculated. However the event is much less likely to run
multiple times (because a solution has already been plotted.) It can run
multiple times for the same record if the report's NextRecord property is
set to False.
Both events provide a counter for how many times it ran (the FormatCount and
PrintCount arguments), and there is also a Retreat event to indicate that
Access is back-tracking.
In general, use the Format event of the section to add text to an unbound
control, because it can then shrink or grow.
If you want to add text or graphics to a specific location on the page
(regardless of how the records are placed), use the Page event of the
report.
The report's Top property lets you know how far down the page this section
is falling, and you can read that in Format or Print. It is measured in
twips, where 1440 twips = 1 inch.
Do not use these events to programmatically accumulate totals over several
pages, nor to repeat the sections multiple times for some records. If the
user views/prints only some pages of the report, the events for the skipped
pages may not fire, so the totals/layout can be wrong.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Luke Bellamy" <bellam...@hotmail.com> wrote in message
news:xDZyf.204$k6....@nasal.pacific.net.au...
---------------
Luke Bellamy
Newcastle, Australia
"Allen Browne" <Allen...@SeeSig.Invalid> wrote in message
news:OtTIfnx...@TK2MSFTNGP10.phx.gbl...
Just a quick related question: Is there any possibility of the FormatCount
resets itself for the same instance of the Detail section?
Relevant details: (WinXP, Access2002, fully patched) I have a Report whose
RecordSource always has only one row / Record. In the Detail_Format
section, I use code to hide & resize & reposition Controls (including 11
SubReport Controls). I was trying to use the FormatCount to ensure that my
hiding / resizing / repositioning code is executed only once. However,
tracing the code show that my code was repeatedly executed but every time
the FormatCount is still shown as 1.
I eventually use a Static Variable to overcome this problem.
--
Thanks
Van
"Allen Browne" <Allen...@SeeSig.Invalid> wrote in message
news:OtTIfnx...@TK2MSFTNGP10.phx.gbl...
I haven't traced this through, Van, but it would be interesting to know if
Access restarts the FormatCount after a Retreat.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Van T. Dinh" <VanThi...@discussions.microsoft.com> wrote in message
news:uo8SIc1G...@TK2MSFTNGP09.phx.gbl...
I was suspicious of the Retreat Event also but the Static Variable got me
out of trouble ...
I will be at th client office tomorrow. Will test the Retreat Event and let
you know whether the FormatCount is restarted by Retreat.
--
HTH
Van T. Dinh
MVP (Access)
"Allen Browne" <Allen...@SeeSig.Invalid> wrote in message
news:O3VVUW2...@TK2MSFTNGP11.phx.gbl...
No, it is not the Retreat Event. The Retreat Event never fired.
In fact, the Retreat Event shouldn't fire the way I set up this Report
(1-row RecordSource). All Controls in the Detail Section have both
CanShrink and CanGrow set to False and I use code to hide, resize &
reposition all Controls (Labels, TextBoxes, PageBreaks, SubReports). If a
Label (+ its associated SubReport) doesn't fit on a page, the code make the
PageBreak Control (placed just above the Label) visible so that the Label (+
its associated SubReport) moves to the next page. Thus, Access should never
need to retreat.
When I tested my intCount (static variable increased each time the Format
Event is executed) vs FormatCount, I got:
intCount FormatCount
1 1
2 2
3 1
(Retreat never fired)
then the Report preview appeared ...
I'll do some most tests and see why the FormatCount is reset and post back
if I can find the cause ...
--
HTH
Van T. Dinh
MVP (Access)
"Allen Browne" <Allen...@SeeSig.Invalid> wrote in message
news:O3VVUW2...@TK2MSFTNGP11.phx.gbl...
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Van T. Dinh" <VanThi...@discussions.microsoft.com> wrote in message
news:OQPFU7%23GGH...@TK2MSFTNGP15.phx.gbl...
I did a bit more test today. Putting a break on the Exit Sub of the
Detail_Format Event and traced the code. After the Exit Sub, the execution
goes right back to the start of the Format Event but the FormatCount went 1,
2 and then back to 1.
I think I stick with my Static intCount for the moment until I can set some
other similar Reports and experiment more.
--
Cheers
Van T. Dinh
MVP (Access)
"Allen Browne" <Allen...@SeeSig.Invalid> wrote in message
news:uQSK$w$GGHA...@TK2MSFTNGP12.phx.gbl...