The Event Sequence for Reports

 < Day Day Up > 

Reports have events too, although the sequence is somewhat less rich than the event sequence for forms, because reports do not allow the user to interact with the data that they display. When you open a report, Access fires a mere two events in this sequence:

  1. Open

  2. Activate

As is the case with forms, these events represent the first point where the report is open enough to run code, and the point where it gains the focus onscreen. When you close a report, you see two corresponding events:

  1. Deactivate

  2. Close

Of course, there's more going on with reports than just opening and closing. In between, Access usually has data to display. For each report section, the event sequence includes up to four events:

  1. Format for the section

  2. Retreat for the section

  3. NoData for the report

  4. Print for the section

The Format event occurs after Access determines which data belongs in a particular section of the report, but before the section is actually formatted. The Retreat event is fired only if Access decides it has to "back up" and reformat a previously formatted section. For example, if you have properties set to keep data together on a page, Access might need to revisit a section it's already formatted to honor those properties. The NoData event is fired whenever a bound section does not return any data. And the Print event occurs after the data is formatted, but before it's actually printed.

Finally, Access fires the report's Page event once for each page in the report, just before that page gets printed.

     < Day Day Up > 


    Automating Microsoft Access with VBA
    Automating Microsoft Access with VBA
    ISBN: 0789732440
    EAN: 2147483647
    Year: 2003
    Pages: 186

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net