C
Carl Colijn
Hi all,
My situation:
I have a maximized main form with a "Reports" button and several subforms on
it. The Reports button needs to open a dialog asking the users what reports
to generate. This report-generating form needs to be modal to the main
form, and may not get maximized; acDialog seems like the perfect match. The
report dialog has some selection controls, a "Generate" and an "Exit"
button. The report form should stay open after generating a report, since
the user might want to generate more than one report.
In this setup, the reports open below the report form (also maximized),
which is fine by me. But when the report form closes, the main form is
lifted up in the z-order and so hides the freshly generated reports; a bit
of an awkward situation to explain to my users. Since reports do not have a
SetFocus method, I cannot re-apply their topmost position in the Report
button code. Relying on a ShowWindow API call with their hWnd is a bit
unnerving to me here (does Access know afterwards which is the object with
the focus in all cases?).
I have tried calling a macro in the Report button that in turn opens the
Reports form in acDialog mode, hoping to loosen the connection of the
Reports form from the main form: it didn't work. Another thing I tried was
opening a dummy form in normal mode, that in turn opens the Reports form in
acDialog mode in it's Open event and then terminates via Cancel = True; same
results again. Using the same dummy form, this time not relying on the
Open/Load/Activate chain events (since they might get called synchronously
in the Report button's context?) but on the Timer event it works, but now I
cannot get this dummy form not to show itself (opening it acHidden just
makes all code stop working and Me.Visible doesn't do a thing, even with
DoEvents).
Another approach might be not to use true Maximized forms but to use the API
to make the forms fill up the whole MDI client area. However, I imagine
that when the user resizes the main Access app in this case, the forms and
reports stay at their old size, which is also not desireable.
Does anyone have a suggestion?
Kind regards,
Carl Colijn
My situation:
I have a maximized main form with a "Reports" button and several subforms on
it. The Reports button needs to open a dialog asking the users what reports
to generate. This report-generating form needs to be modal to the main
form, and may not get maximized; acDialog seems like the perfect match. The
report dialog has some selection controls, a "Generate" and an "Exit"
button. The report form should stay open after generating a report, since
the user might want to generate more than one report.
In this setup, the reports open below the report form (also maximized),
which is fine by me. But when the report form closes, the main form is
lifted up in the z-order and so hides the freshly generated reports; a bit
of an awkward situation to explain to my users. Since reports do not have a
SetFocus method, I cannot re-apply their topmost position in the Report
button code. Relying on a ShowWindow API call with their hWnd is a bit
unnerving to me here (does Access know afterwards which is the object with
the focus in all cases?).
I have tried calling a macro in the Report button that in turn opens the
Reports form in acDialog mode, hoping to loosen the connection of the
Reports form from the main form: it didn't work. Another thing I tried was
opening a dummy form in normal mode, that in turn opens the Reports form in
acDialog mode in it's Open event and then terminates via Cancel = True; same
results again. Using the same dummy form, this time not relying on the
Open/Load/Activate chain events (since they might get called synchronously
in the Report button's context?) but on the Timer event it works, but now I
cannot get this dummy form not to show itself (opening it acHidden just
makes all code stop working and Me.Visible doesn't do a thing, even with
DoEvents).
Another approach might be not to use true Maximized forms but to use the API
to make the forms fill up the whole MDI client area. However, I imagine
that when the user resizes the main Access app in this case, the forms and
reports stay at their old size, which is also not desireable.
Does anyone have a suggestion?
Kind regards,
Carl Colijn