Open Report in Form

G

Guest

I added a command button to a form to open a report.

The form has:

modal=yes, pop-up=yes, and maximized when opened.

I added this line to the command button's open procedure:

Me.Visible = False

Which seems to get the report to show, which is good (before that line, I
had to close the form before the report was visible).

But, when I close the report, I want the form to be visible as it was before
I opened the report. As it stands, when the report is closed, I get the
basic Access page that lists the various forms, reports, etc.

Any suggestions?

Thank you.
 
R

Rick Brandt

jdb said:
I added a command button to a form to open a report.

The form has:

modal=yes, pop-up=yes, and maximized when opened.

I added this line to the command button's open procedure:

Me.Visible = False

Which seems to get the report to show, which is good (before that
line, I had to close the form before the report was visible).

But, when I close the report, I want the form to be visible as it was
before I opened the report. As it stands, when the report is closed,
I get the basic Access page that lists the various forms, reports,
etc.

Any suggestions?

Thank you.

In the Close event of the report set the Form's Visible property back to True.
 
G

Guest

That seems like a good idea, but for whatever reason (such as a near complete
lack of undestand of VBA code), I couldn't get it to work.

So, I tried this:

Private Sub Report_Close()
Dim stDocName As String

stDocName = "SCHS Entry Form"
DoCmd.OpenForm stDocName
DoCmd.Maximize

End Sub

It works, sort of. If I hit the design view, it goes to the form, not
design view. And, it just doesn't seem as elegant as your solution.

Sooooo....any suggestions on how to code (exactly) the visible command, or
how to change the above code to make it better, would be appreciated.

Thank you.
 
R

Rick Brandt

jdb said:
That seems like a good idea, but for whatever reason (such as a near
complete lack of undestand of VBA code), I couldn't get it to work.

So, I tried this:

Private Sub Report_Close()
Dim stDocName As String

stDocName = "SCHS Entry Form"
DoCmd.OpenForm stDocName
DoCmd.Maximize

End Sub

It works, sort of. If I hit the design view, it goes to the form, not
design view. And, it just doesn't seem as elegant as your solution.

Sooooo....any suggestions on how to code (exactly) the visible
command, or how to change the above code to make it better, would be
appreciated.

Private Sub Report_Close()
Forms![SCHS Entry Form].Visible = True
End Sub
 

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

Similar Threads


Top