G
Guest
I am confused by what Access is doing when reports open. It seems to call
some event routines twice as often as it should, and worse.
I have a report that is opened by a form using:
DoCmd.OpenReport ShowKitsReport, acPreview, GetFilteredKits
where GetFilteredKits is the name of a query that returns the records I want
to display. This report opens a companion report (ShowKitsBOMsReport). If
these reports were already opened, they are first closed.
I initially tried opening the report without a filter parameter, then
applying filters after the report opened, plus other ignorant efforts, until
I realised how easy it was to do it this way. Everything works, but, while
debugging, I found weird things happening. Here is the sequence of event
routines (when the query returns 9 records to the report):
1/ Sub Report_Close() called for ShowKitsReport
2/ Sub Report_Close() called for ShowKitsBOMsReport
3/ Sub Report_Activate() called for ShowKitsReport; opens
ShowKitsBOMsReport
4/ Sub Report_Open() called for ShowKitsBOMsReport; record source is set
5/ Sub Report_Activate() called for ShowKitsBOMsReport; no code here
6/ Sub Report_Activate() ends for ShowKitsReport
7/ Sub PageHeaderSection_Format called 1X for ShowKitsReport; unbound
controls receive values
8/ Sub Detail_Format called 9X; no code here
9/ Sub PageHeaderSection_Format called 1X for ShowKitsReport; unbound
controls receive values
10/ Sub Detail_Format called 9X
11/ Sub Report_Activate() called 3X; each time, it is aborted by logic to
prevent reloading companion report and causing an infinite loop of event
routines.
The reports both turn out OK, but the above sequence suggests that things
aren't exactly kosher.
Am I inadvertently creating traps for myself here, or is such apparently
goofy behaviour intrinsic to the process?
some event routines twice as often as it should, and worse.
I have a report that is opened by a form using:
DoCmd.OpenReport ShowKitsReport, acPreview, GetFilteredKits
where GetFilteredKits is the name of a query that returns the records I want
to display. This report opens a companion report (ShowKitsBOMsReport). If
these reports were already opened, they are first closed.
I initially tried opening the report without a filter parameter, then
applying filters after the report opened, plus other ignorant efforts, until
I realised how easy it was to do it this way. Everything works, but, while
debugging, I found weird things happening. Here is the sequence of event
routines (when the query returns 9 records to the report):
1/ Sub Report_Close() called for ShowKitsReport
2/ Sub Report_Close() called for ShowKitsBOMsReport
3/ Sub Report_Activate() called for ShowKitsReport; opens
ShowKitsBOMsReport
4/ Sub Report_Open() called for ShowKitsBOMsReport; record source is set
5/ Sub Report_Activate() called for ShowKitsBOMsReport; no code here
6/ Sub Report_Activate() ends for ShowKitsReport
7/ Sub PageHeaderSection_Format called 1X for ShowKitsReport; unbound
controls receive values
8/ Sub Detail_Format called 9X; no code here
9/ Sub PageHeaderSection_Format called 1X for ShowKitsReport; unbound
controls receive values
10/ Sub Detail_Format called 9X
11/ Sub Report_Activate() called 3X; each time, it is aborted by logic to
prevent reloading companion report and causing an infinite loop of event
routines.
The reports both turn out OK, but the above sequence suggests that things
aren't exactly kosher.
Am I inadvertently creating traps for myself here, or is such apparently
goofy behaviour intrinsic to the process?