E
Erik Eckhardt
I'm using Access 2002 ADP to do some data-driven report formatting. Instead
of putting code in each report to modify itself at run-time, I thought I'd
just make some class modules that knew how to respond to all report events
and take action as the events occur.
Sinking the Open, Close, Activate, etc. events on the Report object itself
works fine. But that's not enough, I need section events. However, when I
declare a variable of type Section, the only events available are *form*
run-time events such as Click, DblClick, MouseDown, and so on.
Report sections that have events are named things like Detail,
PageHeaderSection, ReportHeader, but the names can change, which led me to
this suspicion: Maybe the way Access handles these section events is by
inheriting the generic Report class, because not all reports or forms have
the same sections. For example, you can declare new form events all you like
on a form--it's a class module. But you can't sink those events if the
WithEvents variable you use is declared as type Access.Form. Instead, you
have to declare it as type Form_MyForm, or whatever the name of your form is.
That sucks because if you want to declare a special event on many different
forms, you have to use a separate variable for each form.
So I looked to see if I could declare my variable as Report_MyReport, but
alas, no reports show up in the intellisense dropdown as valid object
declaration types like forms do. But this could explain why neither the
Report object nor the Section object expose the events I want to sink.
I really really wanted to be able to do this, it would be SO powerful and
use so little code and be SO maintainable.
Can someone please help?
Erik
of putting code in each report to modify itself at run-time, I thought I'd
just make some class modules that knew how to respond to all report events
and take action as the events occur.
Sinking the Open, Close, Activate, etc. events on the Report object itself
works fine. But that's not enough, I need section events. However, when I
declare a variable of type Section, the only events available are *form*
run-time events such as Click, DblClick, MouseDown, and so on.
Report sections that have events are named things like Detail,
PageHeaderSection, ReportHeader, but the names can change, which led me to
this suspicion: Maybe the way Access handles these section events is by
inheriting the generic Report class, because not all reports or forms have
the same sections. For example, you can declare new form events all you like
on a form--it's a class module. But you can't sink those events if the
WithEvents variable you use is declared as type Access.Form. Instead, you
have to declare it as type Form_MyForm, or whatever the name of your form is.
That sucks because if you want to declare a special event on many different
forms, you have to use a separate variable for each form.
So I looked to see if I could declare my variable as Report_MyReport, but
alas, no reports show up in the intellisense dropdown as valid object
declaration types like forms do. But this could explain why neither the
Report object nor the Section object expose the events I want to sink.
I really really wanted to be able to do this, it would be SO powerful and
use so little code and be SO maintainable.
Can someone please help?
Erik