Forms Control

Forms Control

am 09.11.2007 20:59:23 von David Grist

Problem Description:

I have a large form called Reports Menu that lists several reports that can
be viewed or printed. Printing works fine. When I click view, the report
opens behind the Reports Menu. I then have to minimize or close the reports
menu to see it.

Can someone help me with code to minimize the reports menu so I can view the
report and when I close the report, restore the reports menu to it's
original size. Here's a sample of the code I currently have.

Private Sub View_Students_by_Last_Click()
On Error GoTo Err_View_Students_by_Last_Click

Dim stDocName As String

stDocName = "Membership - All Students by Last Name"
DoCmd.OpenReport stDocName, acPreview

Exit_View_Students_by_Last_Click:
Exit Sub

Err_View_Students_by_Last_Click:
MsgBox Err.Description
Resume Exit_View_Students_by_Last_Click

End Sub


Thanks for your assistance!

- Dave

Re: Forms Control

am 09.11.2007 22:04:02 von fredg

On Fri, 09 Nov 2007 19:59:23 GMT, David Grist wrote:

> Problem Description:
>
> I have a large form called Reports Menu that lists several reports that can
> be viewed or printed. Printing works fine. When I click view, the report
> opens behind the Reports Menu. I then have to minimize or close the reports
> menu to see it.
>
> Can someone help me with code to minimize the reports menu so I can view the
> report and when I close the report, restore the reports menu to it's
> original size. Here's a sample of the code I currently have.
>
> Private Sub View_Students_by_Last_Click()
> On Error GoTo Err_View_Students_by_Last_Click
>
> Dim stDocName As String
>
> stDocName = "Membership - All Students by Last Name"
> DoCmd.OpenReport stDocName, acPreview
>
> Exit_View_Students_by_Last_Click:
> Exit Sub
>
> Err_View_Students_by_Last_Click:
> MsgBox Err.Description
> Resume Exit_View_Students_by_Last_Click
>
> End Sub
>
> Thanks for your assistance!
>
> - Dave

There is nothing wrong with the code. I would suspect the form that
this code is on is opened acDialog or pop-up, in which case it is
always on top.

My work around would be to add a line of code to the command button
code to make this form not visible:

stDocName = "Membership - All Students by Last Name"
DoCmd.OpenReport stDocName, acPreview
Me.Visible = False


then make it visible again (or close it) in the Report's Close event.

Code the report's Close event:
Forms!FormName.Visible = true

or close the form if it's no longer needed:
DoCmd.Close acForm, "FormName"

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail