Report loses focus

J

JString

I have a report that is launched by a popup form using the docmd.openreport
method.

The problem is that after the report is opened, the focus returns to the
popup form and when it closes, the report is placed behind all other open
forms. And since there doesn't seem to be a setfocus method for reports I
don't know how to keep it in the front after opening it.

Any help would be much appreciated.
 
M

Marshall Barton

JString said:
I have a report that is launched by a popup form using the docmd.openreport
method.

The problem is that after the report is opened, the focus returns to the
popup form and when it closes, the report is placed behind all other open
forms. And since there doesn't seem to be a setfocus method for reports I
don't know how to keep it in the front after opening it.


Why bother with a popup form?

The SelectObject method might be what you're looking for.
 
J

JString

The popup form is called in the report_open event to prompt the user for sort
options.

I gave selectobject a shot but I'm running into error 2530: 'the
selectobject method can't be used on a report that is currently printing.'
 
M

Marshall Barton

Seems like you have a catch 22 kind of thing. Opening the
form in dialog mode might(?) help, but the standard approach
is to have the form open the report instead of the other way
around.
 
K

Kari

I have several reports where I want the user to enter criteria to filter the
data for a report (date range or PO #, for example). I have successfully
used a popup form that opens directly from a menu form. The popup allows
entry of the criteria and has a button to open the report. Code behind the
button makes the popup invisible and opens the report (the popup needs to
stay open so the filter or query can read the values from it). The popup is
then closed in the close event of the report.

I came up with this strategy through trial and error and it works well for
me. I'm no MVP, but I've been using this method for quite some time (over a
year on some reports) and I haven't had any problems with it.

HTH

Kari
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top