By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,570 Members | 999 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,570 IT Pros & Developers. It's quick & easy.

Format event of a report's section

P: n/a
What specifically causes the Format event of a report's section to fire?

Thanks!

Melissa
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Thu, 30 Sep 2004 15:27:40 GMT, "Melissa" <mb****@earthlink.net>
wrote:
What specifically causes the Format event of a report's section to fire?

Thanks!

Melissa

Not sure if the Access help is not specific enough but here it is from
Access 97. The only thing I would say is that you need to be aware of
the retreat event.

David

The Format event occurs when Microsoft Access determines which data
belongs in a report section, but before Microsoft Access formats the
section for previewing or printing.

Remarks

To run a macro or event procedure when this event occurs, set the
OnFormat property to the name of the macro or to [Event Procedure].
A Format event occurs for each section in a report. This allows you to
create complex running calculations by using data from each section,
including sections that aren't printed.
For report detail sections, the Format event occurs for each record in
the section just before Microsoft Access formats the data in the
record. A Format macro or event procedure has access to the data in
the current record.

For report group headers, the Format event occurs for each new group,
and a Format macro or event procedure has access to the data in the
group header and the data in the first record in the detail section.
For report group footers, the Format event occurs for each new group,
and a Format macro or event procedure has access to the data in the
group footer and the data in the last record in the detail section.
By running a macro or an event procedure when the Format event occurs,
you can use data in the current record to make changes to the report
that affect page layout. For example, you can display or hide a
congratulatory message next to a salesperson's monthly sales total in
a sales report, depending on the sales total. After the control is
displayed or hidden, Microsoft Access formats the section by using the
values of format properties, such as CanGrow, CanShrink,
HideDuplicates, KeepTogether, and Visible.

For changes that don't affect page layout or for event procedures or
macros that should run only after the data on a page has been
formatted, such as a macro that prints page totals, use the Print
event for the report section.
There are times when Microsoft Access must return to previous sections
on a report to perform multiple formatting passes. When this happens,
the Retreat event occurs as the report returns to each previous
section, and the Format event occurs more than once for each section.
You can run a macro or event procedure when the Retreat event occurs
to undo any changes that you made when the Format event occurred for
the section. This is useful when your Format macro or event procedure
carries out actions, such as calculating page totals or controlling
the size of a section, that you want to perform only once for each
section.
Nov 13 '05 #2

P: n/a
David,

Can you help me with this ---

I have a grouped report with a subreport in the group footer and the report
starts a new page for each group. The subreport is based on a query which
has criteria in one of the fields. I have a function in a standard module
where the value of the function is part of the criteria. I need to run the
function for each group and have the query requery so the subreport prints
the correct records. Where do I call the function and how do I get the query
to requery so the subreport prints the correct records?

Thanks for any help you can give!!

Melissa

"David Schofield" <d.***************@blueyonder.co.uk> wrote in message
news:415c8157.610116661@localhost...
On Thu, 30 Sep 2004 15:27:40 GMT, "Melissa" <mb****@earthlink.net>
wrote:
What specifically causes the Format event of a report's section to fire?

Thanks!

Melissa

Not sure if the Access help is not specific enough but here it is from
Access 97. The only thing I would say is that you need to be aware of
the retreat event.

David

The Format event occurs when Microsoft Access determines which data
belongs in a report section, but before Microsoft Access formats the
section for previewing or printing.

Remarks

To run a macro or event procedure when this event occurs, set the
OnFormat property to the name of the macro or to [Event Procedure].
A Format event occurs for each section in a report. This allows you to
create complex running calculations by using data from each section,
including sections that aren't printed.
For report detail sections, the Format event occurs for each record in
the section just before Microsoft Access formats the data in the
record. A Format macro or event procedure has access to the data in
the current record.

For report group headers, the Format event occurs for each new group,
and a Format macro or event procedure has access to the data in the
group header and the data in the first record in the detail section.
For report group footers, the Format event occurs for each new group,
and a Format macro or event procedure has access to the data in the
group footer and the data in the last record in the detail section.
By running a macro or an event procedure when the Format event occurs,
you can use data in the current record to make changes to the report
that affect page layout. For example, you can display or hide a
congratulatory message next to a salesperson's monthly sales total in
a sales report, depending on the sales total. After the control is
displayed or hidden, Microsoft Access formats the section by using the
values of format properties, such as CanGrow, CanShrink,
HideDuplicates, KeepTogether, and Visible.

For changes that don't affect page layout or for event procedures or
macros that should run only after the data on a page has been
formatted, such as a macro that prints page totals, use the Print
event for the report section.
There are times when Microsoft Access must return to previous sections
on a report to perform multiple formatting passes. When this happens,
the Retreat event occurs as the report returns to each previous
section, and the Format event occurs more than once for each section.
You can run a macro or event procedure when the Retreat event occurs
to undo any changes that you made when the Format event occurred for
the section. This is useful when your Format macro or event procedure
carries out actions, such as calculating page totals or controlling
the size of a section, that you want to perform only once for each
section.

Nov 13 '05 #3

P: n/a
On Fri, 01 Oct 2004 00:59:07 GMT, "Melissa" <mb****@earthlink.net>
wrote:
David,

Can you help me with this ---

I have a grouped report with a subreport in the group footer and the report
starts a new page for each group. The subreport is based on a query which
has criteria in one of the fields. I have a function in a standard module
where the value of the function is part of the criteria. I need to run the
function for each group and have the query requery so the subreport prints
the correct records. Where do I call the function and how do I get the query
to requery so the subreport prints the correct records?

Thanks for any help you can give!!

Melissa

Hi
Not sure I understand all of this, but I suggest that if your function
has as one of its arguments a field which has a different value for
each group, it should automatically recalculate where needed. Not sure
why you would need to requery.
David

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.