Set focus to reports

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

Hi,

I hope someone can help me with this one. I have a couple
of reports that refuse to become the active window when I
use the Docmd.OpenReport. I have a main form that stays
open throught a users entire session. Now this is what
happens:

I have a customized menu bar that has a listing of the
reports I have. Now I call reports differently. Three
reports call a report to open through the menu. Another
three are opened through a form that collects information
to filter data in the reports after the user has enetered
all required data.

Here's the problem. When I run the reports through the
menu option, the reports become the active window when all
processes are complete (wich is what I want). However,
when I run the reports that require information from
the "information collector" form, the report appears in
the background and the main form automatically becomes the
active window. Why does it do that and how do I stop it?

TIA,
Eric
 
Eric;
To force the focus to the report, copy the requested
information from the request form to one that will remain
open and close the request form see example.
request form = frmVendorHistorysetup (popup)
request form called from = frmreportsmain

Dim stDocName As String
[Forms]![frmreportsmain]![sdate] = Me.Text6 (input
for start date)
[Forms]![frmreportsmain]![edate] = Me.Text8 (input
for end date)

stDocName = "rptHistory" query in report looks to
[Forms]![frmreportsmain]![sdate] and to [Forms]!
[frmreportsmain]![edate] for data.
DoCmd.OpenReport stDocName, acPreview

DoCmd.Close acForm, "frmVendorHistorysetup", acSaveNo
This will leave the focus with the report until the user
closes it.

Good Luck!
 
Back
Top