Can't open a form on top

B

BruceM

When I click a button on my main form to preview a report, the report opens
on top of the form. However, another command button opens a form for
selecting report parameters (a different report than the first button I
mentioned). This report opens behind the main form. There seems to be
nothing I can do to change that other than hiding the main form when I open
the report, and restoring it when I close the report. Here are some things
I have tried:

In the Click event for the button on the parameter form that opens the
report, I have added:
DoCmd.SelectObject acReport, "ReportName"

I have also tried (same Click event):
Reports("ReportName").SetFocus

When I open the report directly from the main form (without using the
parameter form), it opens on top.

I have had to resort to hiding the main form when I open the report by way
of the parameter form, and unhiding (and restoring) the main form when I
close the report.

In all cases, I am opening the report in Preview mode.

I am using Access 2003.

Any ideas as to why this is happening this way? I would like to have a
report property that is the equivalent of "Open on top of everything else,
no matter what".
 
S

Steve

For the button that opens the parameter form, try the following:
DoCmd.OpenForm "NameOfParameterForm",,,,,acDialog
DoCmd.OpenReport "NameOfReport", acPreview
DoCmd.Close "NameOfParameterForm"

Then on your parameter form, use a close button and put the following code
in the click event:
Me.Visible = False

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
B

BruceM

Thanks for the suggestion. The button on frmParam that opens the report
constructs a filter string (strWhere). strDoc has been previously defined
as the report name.
DoCmd.OpenReport strDoc, acViewPreview, , strWhere

I expect that OpenReport won't run in the code you suggested until frmParam
is closed or hidden (since frmParam is pop-up and modal because of
acDialog), but I am left with passing the filter string back from frmParam.
That also seems to be the long way around, although a different long way
than I came up with. I don't see that it offers any advantages, but I may
be missing something.

I was hoping to find a way to in effect set the focus to the report.
 
S

Steve

The advantage is that your report will open on top of the main form. All you
need do is move the code in the click event of the button on frmParam to
below:
DoCmd.OpenForm "NameOfParameterForm",,,,,acDialog
strWhere will be created since frmParam is still open and your report will
be filtered as you wish.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
 
S

StopThisAdvertising

Steve said:
The advantage is that your report will open on top of the main form. All you
need do is move the code in the click event of the button on frmParam to
below:
DoCmd.OpenForm "NameOfParameterForm",,,,,acDialog
strWhere will be created since frmParam is still open and your report will
be filtered as you wish.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)

--
You are *not* a resource at all !!
Stop advertising here, or get lost for another year or so...
http://home.tiscali.nl/arracom/whoissteve.html

ArnoR
 
B

BruceM

I meant there is about the same amount of coding in both cases. But I tried
your way, and it worked after some minor modification. I have used strWhere
in other code, so I needed to come up with a unique global variable. I
think it is a tidier method than mine, so I thank you for the suggestion,
which I have implemented. I am still irritated that it is so difficult to
get a report to appear in front of a form in some cases.
 
M

Marshall Barton

While I abhor Steve's "contact me for . . ." posts, I don't
see anything wrong in this thread. He is providing
legitimate assistance and only his sig (which is a
reasonable length) mentions that consulting is his business.
--
Marsh
MVP [MS Access]


StopThisAdvertising wrote:

You are *not* a resource at all !!
Stop advertising here, or get lost for another year or so...
http://home.tiscali.nl/arracom/whoissteve.html

ArnoR
 
S

StopThisAdvertising

Marshall Barton said:
While I abhor Steve's "contact me for . . ." posts, I don't
see anything wrong in this thread. He is providing
legitimate assistance and only his sig (which is a
reasonable length) mentions that consulting is his business.

Hi Marsh,

I was expecting people te respond the way you do Marsh.
(Dirk Goldgar had a similar reaction in microsoft.public.access.forms)

In fact I fully agree with your point that Steve did not advertise *here* in this particular post.

But we warned Steve over and over again, and I told him several times that I intended to hunt *all* his posts.

What is Steve's game? Well he posts a few 'nice' answers here and there, and advertises in another thread again.
After what we went trough the last time (you remember this I suppose ?) we don't feel like playing *that* game again.

He did *not* respond to all our warnings and plee's here...
He did *not* give a shit about what you and I and others said....
He did *not* stop being an a$$hole...
He did *not* even respond when people call him "an oily snake.." (less than 1 week ago)

He has been away for almost a year and all was quiet here (I mean NO adds...)
When he came back, in short: he did *not* stop advertising...

==> I simply want him to leave the groups or stop advertising here.
Playing this 'the nice way' is not going to work IMNSHO.
I guess he askes to be 'slammed' in the face.

So I am afraid Steve triggered some 'answering-machine' this time.
I am afraid it is impossible to stop this machine within the next few weeks...

I simply provide a link to the website after *all* his posts here. Easier for me and more effective I hope.

FYI: Steve has tried to close down the website last year. He complained about me !!
Last three days only: 151 pageloads from 47 unique visitors.==> very effective !!

It is a shame but ... I hope this will be over very soon again.

BTW: Be sure to know that I do respect your opinion.

ArnoR
 
M

Marshall Barton

StopThisAdvertising said:
"Marshall Barton" schreef

Hi Marsh,

I was expecting people te respond the way you do Marsh.
(Dirk Goldgar had a similar reaction in microsoft.public.access.forms)

In fact I fully agree with your point that Steve did not advertise *here* in this particular post.

But we warned Steve over and over again, and I told him several times that I intended to hunt *all* his posts.

What is Steve's game? Well he posts a few 'nice' answers here and there, and advertises in another thread again.
After what we went trough the last time (you remember this I suppose ?) we don't feel like playing *that* game again.

He did *not* respond to all our warnings and plee's here...
He did *not* give a shit about what you and I and others said....
He did *not* stop being an a$$hole...
He did *not* even respond when people call him "an oily snake.." (less than 1 week ago)

He has been away for almost a year and all was quiet here (I mean NO adds...)
When he came back, in short: he did *not* stop advertising...

==> I simply want him to leave the groups or stop advertising here.
Playing this 'the nice way' is not going to work IMNSHO.
I guess he askes to be 'slammed' in the face.

So I am afraid Steve triggered some 'answering-machine' this time.
I am afraid it is impossible to stop this machine within the next few weeks...

I simply provide a link to the website after *all* his posts here. Easier for me and more effective I hope.

FYI: Steve has tried to close down the website last year. He complained about me !!
Last three days only: 151 pageloads from 47 unique visitors.==> very effective !!

It is a shame but ... I hope this will be over very soon again.

BTW: Be sure to know that I do respect your opinion.


IMO, attacking good behavior is not an effective method of
correcting bad behavior.
 

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