Opening and closing forms help

P

Prohock

I have a form called "StudentReport" when I click the "view" button I want
the form to hide (Not minimize as when StudentReport is minimized, it blocks
my page: buttons on the lower left) and the report to open. When closing the
report "Report" I want the "StudentReport" to unhide.

Everything works just fine (even "student Report" is visible again) but I
get the following VB error:
"RunTime Error '424': Object Required"

Here is the code:

VB for opening report located in "StudentReport"

Me.Visible = False
DoCmd.OpenReport "Report", acViewPreview, , strWhere

VB for closing report located in "Report"

Private Sub Report_close()
DoCmd.SelectObject acForm, "StudentReport", yes
StudentReport.Visible = True
End Sub

Please help!
 
S

Stuart McCall

Prohock said:
I have a form called "StudentReport" when I click the "view" button I want
the form to hide (Not minimize as when StudentReport is minimized, it
blocks
my page: buttons on the lower left) and the report to open. When closing
the
report "Report" I want the "StudentReport" to unhide.

Everything works just fine (even "student Report" is visible again) but I
get the following VB error:
"RunTime Error '424': Object Required"

Here is the code:

VB for opening report located in "StudentReport"

Me.Visible = False
DoCmd.OpenReport "Report", acViewPreview, , strWhere

VB for closing report located in "Report"

Private Sub Report_close()
DoCmd.SelectObject acForm, "StudentReport", yes
StudentReport.Visible = True
End Sub

Please help!

This line:

StudentReport.Visible = True

needs to be:

Forms!StudentReport.Visible = True
 

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