How can I SetFocus or SelectObject for a report?

M

Max Moor

Hi All,

I have an Access 2002 application where I may have multiple forms and
reports open at one time. They are all maximized. I have a "LeftNav" form
that is always open and always visible that does open form/report window
management.

The user clicks the name of an open form or report in a list on the
LeftNav, and some VBA code brings that window to the top. For forms and
regular reports, I call:

DoCmd.SelectObject acForm, strWindowName, False

Some of my forms and reports are multiple copies of the same form or
report opened with different data filters. I open these via a collection,
so I can open the various copies with the "New' keyword and manage them
individually.

Unfortunately, these items are only accessible via their underlying
form or report object. I can't refer to them via their form or repport
name, because there may be two or three open by the same name (their
caption is unique, and used as the collection's key).

For forms, I can call the form object's SetFocus method, and the
window pops to the top. Report objects don't have a SetFocus method,
though. How can I get an open, but buried, report preview window to pop to
the top?

Regards,
Max
 
M

Max Moor

Hi All,

I have an Access 2002 application where I may have multiple
forms and
reports open at one time. They are all maximized. I have a "LeftNav"
form that is always open and always visible that does open form/report
window management.

The user clicks the name of an open form or report in a list on
the
LeftNav, and some VBA code brings that window to the top. For forms and
regular reports, I call:

DoCmd.SelectObject acForm, strWindowName, False

Some of my forms and reports are multiple copies of the same
form or
report opened with different data filters. I open these via a
collection, so I can open the various copies with the "New' keyword and
manage them individually.

Unfortunately, these items are only accessible via their
underlying
form or report object. I can't refer to them via their form or repport
name, because there may be two or three open by the same name (their
caption is unique, and used as the collection's key).

For forms, I can call the form object's SetFocus method, and
the
window pops to the top. Report objects don't have a SetFocus method,
though. How can I get an open, but buried, report preview window to pop
to the top?

Regards,
Max


I've been playing around. The best I've come up with so far is to set
the report's Visible porperty to false, then back to true. This brings it
to the top. If there's another way known, I'd still be interested.

Regards,
Max
 
A

Allen Browne

Max, I didn't reply in case someone had a suggestions for you.

FWIW, I never did get multiple instances of reports working well in Access.
I've used the Visible trick, but it's at best a workaround that could not be
guaranteed reliable in future versions. Even worse, the whole point of using
multiple instances is so they can show different data (typically with
different filtering applied), but Access doesn't handle the filters
correctly (prior to A2007.) Details:
Incorrect filtering of forms and reports
at:
http://allenbrowne.com/bug-02.html

At that point, I gave up trying to use multiple instances in any reliable
way. If you get some good solutions, we're interested in hearing.
 
M

Max Moor

Max, I didn't reply in case someone had a suggestions for you.

FWIW, I never did get multiple instances of reports working well in
Access. I've used the Visible trick, but it's at best a workaround that
could not be guaranteed reliable in future versions. Even worse, the
whole point of using multiple instances is so they can show different
data (typically with different filtering applied), but Access doesn't
handle the filters correctly (prior to A2007.) Details:
Incorrect filtering of forms and reports
at:
http://allenbrowne.com/bug-02.html

At that point, I gave up trying to use multiple instances in any
reliable way. If you get some good solutions, we're interested in
hearing.

Hi Allen,

I'm in the midst of the mundane just now, back with the forms, getting
things to resize properly when the app window changes. I'm pretty heavily
invested in this thing, so I'll have to come up with something. Hopefully,
the monster won't be too ugly. :)

I'll drop a note here when I get things working.

Regards,
Max
 

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