Need Rpt w/ & w/o Detail Visible

G

Guest

Hi everyone! Using A02 on XP. Have a great report with details and would
like to have 2 buttons, one to open it with Details.Visible=No and one to
open it with Details.Visible=Yes.

Here is what I have now:

Private Sub Command7_Click()
On Error GoTo Err_Command7_Click

Dim stDocName As String

stDocName = "FeesGeneratedFromToByAdmRpt"
DoCmd.OpenReport stDocName, acPreview

Exit_Command7_Click:
Exit Sub

Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click

End Sub

How/where do I tell it to be Detail.Visible=Yes/No?

Thanks in advance for your time and consideration.
 
J

Jeff Boyce

Bonnie

Another way to approach this would be to have a single command button that
opens the report, plus a checkbox for "Show Details" (let's call it
[chkShowDetails]) on your form. When the button is clicked, open the report
as you do now.

In the report's OnOpen event, add in the following code (your syntax may
vary):

Me.Detail.Visible = Forms!YourFormName!chkShowDetails

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
G

Guest

Jeff!!! Thanks SO much! It works perfectly!

I really appreciate the help you give to others, it has made my day!

Have a wonderful weekend!
--
Bonnie


Jeff Boyce said:
Bonnie

Another way to approach this would be to have a single command button that
opens the report, plus a checkbox for "Show Details" (let's call it
[chkShowDetails]) on your form. When the button is clicked, open the report
as you do now.

In the report's OnOpen event, add in the following code (your syntax may
vary):

Me.Detail.Visible = Forms!YourFormName!chkShowDetails

Regards

Jeff Boyce
Microsoft Office/Access MVP



Bonnie said:
Hi everyone! Using A02 on XP. Have a great report with details and would
like to have 2 buttons, one to open it with Details.Visible=No and one to
open it with Details.Visible=Yes.

Here is what I have now:

Private Sub Command7_Click()
On Error GoTo Err_Command7_Click

Dim stDocName As String

stDocName = "FeesGeneratedFromToByAdmRpt"
DoCmd.OpenReport stDocName, acPreview

Exit_Command7_Click:
Exit Sub

Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click

End Sub

How/where do I tell it to be Detail.Visible=Yes/No?

Thanks in advance for your time and consideration.
 
G

Guest

Thanks Jeff, that was exactly what I was looking for when I posted a thread
about passing a condition from a form to a report. I just adapted your
suggestion it by making my [Name3] field visible or not.
You MPVs are helping out a lot of people
Thanks again
CurtainMary


Jeff Boyce said:
Bonnie

Another way to approach this would be to have a single command button that
opens the report, plus a checkbox for "Show Details" (let's call it
[chkShowDetails]) on your form. When the button is clicked, open the report
as you do now.

In the report's OnOpen event, add in the following code (your syntax may
vary):

Me.Detail.Visible = Forms!YourFormName!chkShowDetails

Regards

Jeff Boyce
Microsoft Office/Access MVP



Bonnie said:
Hi everyone! Using A02 on XP. Have a great report with details and would
like to have 2 buttons, one to open it with Details.Visible=No and one to
open it with Details.Visible=Yes.

Here is what I have now:

Private Sub Command7_Click()
On Error GoTo Err_Command7_Click

Dim stDocName As String

stDocName = "FeesGeneratedFromToByAdmRpt"
DoCmd.OpenReport stDocName, acPreview

Exit_Command7_Click:
Exit Sub

Err_Command7_Click:
MsgBox Err.Description
Resume Exit_Command7_Click

End Sub

How/where do I tell it to be Detail.Visible=Yes/No?

Thanks in advance for your time and consideration.
 

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