By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,689 Members | 1,760 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,689 IT Pros & Developers. It's quick & easy.

Hide report (detail) section via Code at Run time

P: n/a
Hi -
Is it possible to hide the detail section of a report at run time?

I have a report that prints all details, with summary lines. The user
would like the report ALSO with just summary lines.

It seems the simplest thing is to run the code (see below) once with
the detail section showing, and a second time hiding the detail
section. I can't figure out the code to do that and don't see it
posted.

Thanks -
Sara

strDocName = "rptPaymentDueDateandDollars"

strStepErrorMsg = "Tell IT there was a problem with Details
Committed Dollars Report"

strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile
DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile ' works fine

strStepErrorMsg = "Tell IT there was a problem with Summary
Committed Dollars Report"

strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile

' Print same report again, but hide the Detail section

DoCmd.OpenReport strDocName, acViewPreview, , _
"rptPaymentDueDateandDollars.Detail.Visible = False" '
gives error

DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile

DoCmd.Close acReport, strDocName

Sep 7 '07 #1
Share this Question
Share on Google+
10 Replies


P: n/a

"sara" <sa*******@yahoo.comwrote in message
news:11*********************@r34g2000hsd.googlegro ups.com...
Hi -
Is it possible to hide the detail section of a report at run time?

I have a report that prints all details, with summary lines. The user
would like the report ALSO with just summary lines.

It seems the simplest thing is to run the code (see below) once with
the detail section showing, and a second time hiding the detail
section. I can't figure out the code to do that and don't see it
posted.

Thanks -
Sara

strDocName = "rptPaymentDueDateandDollars"

strStepErrorMsg = "Tell IT there was a problem with Details
Committed Dollars Report"

strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile
DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile ' works fine

strStepErrorMsg = "Tell IT there was a problem with Summary
Committed Dollars Report"

strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile

' Print same report again, but hide the Detail section

DoCmd.OpenReport strDocName, acViewPreview, , _
"rptPaymentDueDateandDollars.Detail.Visible = False" '
gives error

DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile

DoCmd.Close acReport, strDocName
Add the following to the report's open event.

If MsgBox("Show detail and summary?", vbYesNo, "Confirm") = vbNo Then
Me.Section(0).Visible = False
End If

The user will need to respond each time the report is opened, the default is
to show the detail section.
Sep 7 '07 #2

P: n/a
On Sep 7, 1:27 pm, "paii, Ron" <n...@no.comwrote:
"sara" <saraqp...@yahoo.comwrote in message

news:11*********************@r34g2000hsd.googlegro ups.com...


Hi -
Is it possible to hide the detail section of a report at run time?
I have a report that prints all details, with summary lines. The user
would like the report ALSO with just summary lines.
It seems the simplest thing is to run the code (see below) once with
the detail section showing, and a second time hiding the detail
section. I can't figure out the code to do that and don't see it
posted.
Thanks -
Sara
strDocName = "rptPaymentDueDateandDollars"
strStepErrorMsg = "Tell IT there was a problem with Details
Committed Dollars Report"
strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile
DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile ' works fine
strStepErrorMsg = "Tell IT there was a problem with Summary
Committed Dollars Report"
strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile
' Print same report again, but hide the Detail section
DoCmd.OpenReport strDocName, acViewPreview, , _
"rptPaymentDueDateandDollars.Detail.Visible = False" '
gives error
DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile
DoCmd.Close acReport, strDocName

Add the following to the report's open event.

If MsgBox("Show detail and summary?", vbYesNo, "Confirm") = vbNo Then
Me.Section(0).Visible = False
End If

The user will need to respond each time the report is opened, the default is
to show the detail section.- Hide quoted text -

- Show quoted text -

Is there any way to do it so the user doesn't have to respond? So it
automatically creates the two reports from the one definition -
Detail, summary?

thanks -
Sara

Sep 7 '07 #3

P: n/a
sara wrote:
On Sep 7, 1:27 pm, "paii, Ron" <n...@no.comwrote:
>>"sara" <saraqp...@yahoo.comwrote in message

news:11*********************@r34g2000hsd.googleg roups.com...

>>>Hi -
Is it possible to hide the detail section of a report at run time?
>>>I have a report that prints all details, with summary lines. The user
would like the report ALSO with just summary lines.
>>>It seems the simplest thing is to run the code (see below) once with
the detail section showing, and a second time hiding the detail
section. I can't figure out the code to do that and don't see it
posted.
>>>Thanks -
Sara
>> strDocName = "rptPaymentDueDateandDollars"
>> strStepErrorMsg = "Tell IT there was a problem with Details
Committed Dollars Report"
>> strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile
DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile ' works fine
>> strStepErrorMsg = "Tell IT there was a problem with Summary
Committed Dollars Report"
>> strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile
>>>' Print same report again, but hide the Detail section
>> DoCmd.OpenReport strDocName, acViewPreview, , _
"rptPaymentDueDateandDollars.Detail.Visible = False" '
gives error
>> DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile
>> DoCmd.Close acReport, strDocName

Add the following to the report's open event.

If MsgBox("Show detail and summary?", vbYesNo, "Confirm") = vbNo Then
Me.Section(0).Visible = False
End If

The user will need to respond each time the report is opened, the default is
to show the detail section.- Hide quoted text -

- Show quoted text -

Is there any way to do it so the user doesn't have to respond? So it
automatically creates the two reports from the one definition -
Detail, summary?

thanks -
Sara
Do it from the form that calls the report...if you have one. You can
give the options to print or preview, summary, detail, and any filters
from the form. In the OnOpen event of the report you can do whatever
setting you like.
Sep 7 '07 #4

P: n/a
On Sep 7, 2:44 pm, Salad <o...@vinegar.comwrote:
sara wrote:
On Sep 7, 1:27 pm, "paii, Ron" <n...@no.comwrote:
>"sara" <saraqp...@yahoo.comwrote in message
>news:11*********************@r34g2000hsd.googlegr oups.com...
>>Hi -
Is it possible to hide the detail section of a report at run time?
>>I have a report that prints all details, with summary lines. The user
would like the report ALSO with just summary lines.
>>It seems the simplest thing is to run the code (see below) once with
the detail section showing, and a second time hiding the detail
section. I can't figure out the code to do that and don't see it
posted.
>>Thanks -
Sara
> strDocName = "rptPaymentDueDateandDollars"
> strStepErrorMsg = "Tell IT there was a problem with Details
Committed Dollars Report"
> strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile
DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile ' works fine
> strStepErrorMsg = "Tell IT there was a problem with Summary
Committed Dollars Report"
> strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile
>>' Print same report again, but hide the Detail section
> DoCmd.OpenReport strDocName, acViewPreview, , _
"rptPaymentDueDateandDollars.Detail.Visible = False" '
gives error
> DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile
> DoCmd.Close acReport, strDocName
>Add the following to the report's open event.
If MsgBox("Show detail and summary?", vbYesNo, "Confirm") = vbNo Then
Me.Section(0).Visible = False
End If
>The user will need to respond each time the report is opened, the default is
to show the detail section.- Hide quoted text -
>- Show quoted text -
Is there any way to do it so the user doesn't have to respond? So it
automatically creates the two reports from the one definition -
Detail, summary?
thanks -
Sara

Do it from the form that calls the report...if you have one. You can
give the options to print or preview, summary, detail, and any filters
from the form. In the OnOpen event of the report you can do whatever
setting you like.- Hide quoted text -

- Show quoted text -
I don't understand. I am doing this from the form. I just want the
user to choose an option on the form and have the report run twice -
once with the detail showing and once with it hidden. How do I "set"
the Detail.Visible to False for the second run? Maybe it can't be
done. Since the user Always wants the two reports to run, I don't
want to make him click twice or choose anything - just do what he
asked me to do.

Is it possible with no user intervention?

Sara

Sep 7 '07 #5

P: n/a
sara wrote:
On Sep 7, 2:44 pm, Salad <o...@vinegar.comwrote:
>>sara wrote:
>>>On Sep 7, 1:27 pm, "paii, Ron" <n...@no.comwrote:
>>>>"sara" <saraqp...@yahoo.comwrote in message
>>>>news:11*********************@r34g2000hsd.googl egroups.com...
>>>>>Hi -
>Is it possible to hide the detail section of a report at run time?
>>>>>I have a report that prints all details, with summary lines. The user
>would like the report ALSO with just summary lines.
>>>>>It seems the simplest thing is to run the code (see below) once with
>the detail section showing, and a second time hiding the detail
>section. I can't figure out the code to do that and don't see it
>posted.
>>>>>Thanks -
>Sara
>>>> strDocName = "rptPaymentDueDateandDollars"
>>>> strStepErrorMsg = "Tell IT there was a problem with Details
>Committed Dollars Report"
>>>> strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile
DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
>_
strPathAndFile ' works fine
>>>> strStepErrorMsg = "Tell IT there was a problem with Summary
>Committed Dollars Report"
>>>> strFile = strDocName & ".snp"
strPathAndFile = strPath & strFile
>>>>>' Print same report again, but hide the Detail section
>>>> DoCmd.OpenReport strDocName, acViewPreview, , _
"rptPaymentDueDateandDollars.Detail.Visible = False" '
>gives error
>>>> DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
>_
strPathAndFile
>>>> DoCmd.Close acReport, strDocName
>>>>Add the following to the report's open event.
>>> If MsgBox("Show detail and summary?", vbYesNo, "Confirm") = vbNo Then
Me.Section(0).Visible = False
End If
>>>>The user will need to respond each time the report is opened, the default is
to show the detail section.- Hide quoted text -
>>>>- Show quoted text -
>>>Is there any way to do it so the user doesn't have to respond? So it
automatically creates the two reports from the one definition -
Detail, summary?
>>>thanks -
Sara

Do it from the form that calls the report...if you have one. You can
give the options to print or preview, summary, detail, and any filters
from the form. In the OnOpen event of the report you can do whatever
setting you like.- Hide quoted text -

- Show quoted text -


I don't understand. I am doing this from the form. I just want the
user to choose an option on the form and have the report run twice -
once with the detail showing and once with it hidden. How do I "set"
the Detail.Visible to False for the second run? Maybe it can't be
done. Since the user Always wants the two reports to run, I don't
want to make him click twice or choose anything - just do what he
asked me to do.

Is it possible with no user intervention?
I guess that's up to the designer and programmer. If that's what they
want, they need to code it to do so.

I like to give my users option. Like...print preview, send to printer.

You could give them additional options like Detail Report, Summary
Report, Both.

Maybe you only want records for an employee. Or records in a date range.

Now if printing both, create a field in your form. If detail, set the
txtbox to "Detail" then call the report. If Summary, set it to
"Summary" and call the report. The code in the report could check
If Forms!MyReport!TxtBox = "Detail" Then
ElseIf Forms!MyReport!TxtBox = "Summary"
Else
Endif

The user always wants to print both. I still say give an option group
and default to "Both".

Sara
Sep 7 '07 #6

P: n/a

"sara" <sa*******@yahoo.comwrote in message
news:11*********************@y42g2000hsy.googlegro ups.com...
On Sep 7, 2:44 pm, Salad <o...@vinegar.comwrote:
sara wrote:
On Sep 7, 1:27 pm, "paii, Ron" <n...@no.comwrote:
>>"sara" <saraqp...@yahoo.comwrote in message
>>news:11*********************@r34g2000hsd.googleg roups.com...
>>>Hi -
>>>Is it possible to hide the detail section of a report at run time?
>>>I have a report that prints all details, with summary lines. The
user
>>>would like the report ALSO with just summary lines.
>>>It seems the simplest thing is to run the code (see below) once with
>>>the detail section showing, and a second time hiding the detail
>>>section. I can't figure out the code to do that and don't see it
>>>posted.
>>>Thanks -
>>>Sara
>> strDocName = "rptPaymentDueDateandDollars"
>> strStepErrorMsg = "Tell IT there was a problem with Details
>>>Committed Dollars Report"
>> strFile = strDocName & ".snp"
>> strPathAndFile = strPath & strFile
>> DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
>>>_
>> strPathAndFile ' works fine
>> strStepErrorMsg = "Tell IT there was a problem with Summary
>>>Committed Dollars Report"
>> strFile = strDocName & ".snp"
>> strPathAndFile = strPath & strFile
>>>' Print same report again, but hide the Detail section
>> DoCmd.OpenReport strDocName, acViewPreview, , _
>> "rptPaymentDueDateandDollars.Detail.Visible = False" '
>>>gives error
>> DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
>>>_
>> strPathAndFile
>> DoCmd.Close acReport, strDocName
>>Add the following to the report's open event.
> If MsgBox("Show detail and summary?", vbYesNo, "Confirm") = vbNo
Then
> Me.Section(0).Visible = False
> End If
>>The user will need to respond each time the report is opened, the
default is
>>to show the detail section.- Hide quoted text -
>>- Show quoted text -
Is there any way to do it so the user doesn't have to respond? So it
automatically creates the two reports from the one definition -
Detail, summary?
thanks -
Sara
Do it from the form that calls the report...if you have one. You can
give the options to print or preview, summary, detail, and any filters
from the form. In the OnOpen event of the report you can do whatever
setting you like.- Hide quoted text -

- Show quoted text -

I don't understand. I am doing this from the form. I just want the
user to choose an option on the form and have the report run twice -
once with the detail showing and once with it hidden. How do I "set"
the Detail.Visible to False for the second run? Maybe it can't be
done. Since the user Always wants the two reports to run, I don't
want to make him click twice or choose anything - just do what he
asked me to do.

Is it possible with no user intervention?

Sara
Replace msgbox with a reference to your form's control

If Forms![YourFormName]![YourControlName] = False Then
Me.Section(0).Visible = False
EndIf

OR

Me.Section(0).Visible = Forms![YourFormName]![YourControlName]
Sep 7 '07 #7

P: n/a
On Sep 7, 3:50 pm, "paii, Ron" <n...@no.comwrote:
"sara" <saraqp...@yahoo.comwrote in message

news:11*********************@y42g2000hsy.googlegro ups.com...


On Sep 7, 2:44 pm, Salad <o...@vinegar.comwrote:
sara wrote:
On Sep 7, 1:27 pm, "paii, Ron" <n...@no.comwrote:
>"sara" <saraqp...@yahoo.comwrote in message
>news:11*********************@r34g2000hsd.googlegr oups.com...
>>Hi -
>>Is it possible to hide the detail section of a report at run time?
>>I have a report that prints all details, with summary lines. The
user
>>would like the report ALSO with just summary lines.
>>It seems the simplest thing is to run the code (see below) once with
>>the detail section showing, and a second time hiding the detail
>>section. I can't figure out the code to do that and don't see it
>>posted.
>>Thanks -
>>Sara
> strDocName = "rptPaymentDueDateandDollars"
> strStepErrorMsg = "Tell IT there was a problem with Details
>>Committed Dollars Report"
> strFile = strDocName & ".snp"
> strPathAndFile = strPath & strFile
> DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
>>_
> strPathAndFile ' works fine
> strStepErrorMsg = "Tell IT there was a problem with Summary
>>Committed Dollars Report"
> strFile = strDocName & ".snp"
> strPathAndFile = strPath & strFile
>>' Print same report again, but hide the Detail section
> DoCmd.OpenReport strDocName, acViewPreview, , _
> "rptPaymentDueDateandDollars.Detail.Visible = False" '
>>gives error
> DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
>>_
> strPathAndFile
> DoCmd.Close acReport, strDocName
>Add the following to the report's open event.
If MsgBox("Show detail and summary?", vbYesNo, "Confirm") = vbNo
Then
Me.Section(0).Visible = False
End If
>The user will need to respond each time the report is opened, the
default is
>to show the detail section.- Hide quoted text -
>- Show quoted text -
Is there any way to do it so the user doesn't have to respond? So it
automatically creates the two reports from the one definition -
Detail, summary?
thanks -
Sara
Do it from the form that calls the report...if you have one. You can
give the options to print or preview, summary, detail, and any filters
from the form. In the OnOpen event of the report you can do whatever
setting you like.- Hide quoted text -
- Show quoted text -
I don't understand. I am doing this from the form. I just want the
user to choose an option on the form and have the report run twice -
once with the detail showing and once with it hidden. How do I "set"
the Detail.Visible to False for the second run? Maybe it can't be
done. Since the user Always wants the two reports to run, I don't
want to make him click twice or choose anything - just do what he
asked me to do.
Is it possible with no user intervention?
Sara

Replace msgbox with a reference to your form's control

If Forms![YourFormName]![YourControlName] = False Then
Me.Section(0).Visible = False
EndIf

OR

Me.Section(0).Visible = Forms![YourFormName]![YourControlName]- Hide quoted text -

- Show quoted text -
THANK YOU!!! This worked! I had a feeling it was simple, and it
was.

I just put the line Me.Section(0).Visible = False right above
printing the report again and it worked.

Many thanks!
Sara

Sep 7 '07 #8

P: n/a
On Sep 7, 3:50 pm, "paii, Ron" <n...@no.comwrote:
"sara" <saraqp...@yahoo.comwrote in message

news:11*********************@y42g2000hsy.googlegro ups.com...


On Sep 7, 2:44 pm, Salad <o...@vinegar.comwrote:
sara wrote:
On Sep 7, 1:27 pm, "paii, Ron" <n...@no.comwrote:
>"sara" <saraqp...@yahoo.comwrote in message
>news:11*********************@r34g2000hsd.googlegr oups.com...
>>Hi -
>>Is it possible to hide the detail section of a report at run time?
>>I have a report that prints all details, with summary lines. The
user
>>would like the report ALSO with just summary lines.
>>It seems the simplest thing is to run the code (see below) once with
>>the detail section showing, and a second time hiding the detail
>>section. I can't figure out the code to do that and don't see it
>>posted.
>>Thanks -
>>Sara
> strDocName = "rptPaymentDueDateandDollars"
> strStepErrorMsg = "Tell IT there was a problem with Details
>>Committed Dollars Report"
> strFile = strDocName & ".snp"
> strPathAndFile = strPath & strFile
> DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
>>_
> strPathAndFile ' works fine
> strStepErrorMsg = "Tell IT there was a problem with Summary
>>Committed Dollars Report"
> strFile = strDocName & ".snp"
> strPathAndFile = strPath & strFile
>>' Print same report again, but hide the Detail section
> DoCmd.OpenReport strDocName, acViewPreview, , _
> "rptPaymentDueDateandDollars.Detail.Visible = False" '
>>gives error
> DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
>>_
> strPathAndFile
> DoCmd.Close acReport, strDocName
>Add the following to the report's open event.
If MsgBox("Show detail and summary?", vbYesNo, "Confirm") = vbNo
Then
Me.Section(0).Visible = False
End If
>The user will need to respond each time the report is opened, the
default is
>to show the detail section.- Hide quoted text -
>- Show quoted text -
Is there any way to do it so the user doesn't have to respond? So it
automatically creates the two reports from the one definition -
Detail, summary?
thanks -
Sara
Do it from the form that calls the report...if you have one. You can
give the options to print or preview, summary, detail, and any filters
from the form. In the OnOpen event of the report you can do whatever
setting you like.- Hide quoted text -
- Show quoted text -
I don't understand. I am doing this from the form. I just want the
user to choose an option on the form and have the report run twice -
once with the detail showing and once with it hidden. How do I "set"
the Detail.Visible to False for the second run? Maybe it can't be
done. Since the user Always wants the two reports to run, I don't
want to make him click twice or choose anything - just do what he
asked me to do.
Is it possible with no user intervention?
Sara

Replace msgbox with a reference to your form's control

If Forms![YourFormName]![YourControlName] = False Then
Me.Section(0).Visible = False
EndIf

OR

Me.Section(0).Visible = Forms![YourFormName]![YourControlName]- Hide quoted text -

- Show quoted text -
I may have spoken too soon. What is happening when I run this from my
form, is that it's not hiding the detail section, but was hiding the
form section. (I figured out how to put that back). I don't know how
to reference the report to hide the section.

Code:
strFile = "Summary " & strDocName & ".snp"
strPathAndFile = strPath & strFile
Me.Section(0).Visible = False
DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile

Forms![frmPrintPOReports].Section(0).Visible = True

I tried Reports!rptPaymentDueDateandDollars.Section(0).Vis ible =
False
but I get an error messagy saying "rptPaymentDueDateandDollars is
missing or misspelled"

Help!!!
Sara

Sep 7 '07 #9

P: n/a

"sara" <sa*******@yahoo.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...
On Sep 7, 3:50 pm, "paii, Ron" <n...@no.comwrote:
"sara" <saraqp...@yahoo.comwrote in message

news:11*********************@y42g2000hsy.googlegro ups.com...


On Sep 7, 2:44 pm, Salad <o...@vinegar.comwrote:
sara wrote:
On Sep 7, 1:27 pm, "paii, Ron" <n...@no.comwrote:
>>"sara" <saraqp...@yahoo.comwrote in message
>>news:11*********************@r34g2000hsd.googleg roups.com...
>>>Hi -
>>>Is it possible to hide the detail section of a report at run
time?
>>>I have a report that prints all details, with summary lines. The
user
>>>would like the report ALSO with just summary lines.
>>>It seems the simplest thing is to run the code (see below) once
with
>>>the detail section showing, and a second time hiding the detail
>>>section. I can't figure out the code to do that and don't see it
>>>posted.
>>>Thanks -
>>>Sara
>> strDocName = "rptPaymentDueDateandDollars"
>> strStepErrorMsg = "Tell IT there was a problem with
Details
>>>Committed Dollars Report"
>> strFile = strDocName & ".snp"
>> strPathAndFile = strPath & strFile
>> DoCmd.OutputTo acOutputReport, strDocName, "snapshot
format",
>>>_
>> strPathAndFile ' works fine
>> strStepErrorMsg = "Tell IT there was a problem with
Summary
>>>Committed Dollars Report"
>> strFile = strDocName & ".snp"
>> strPathAndFile = strPath & strFile
>>>' Print same report again, but hide the Detail section
>> DoCmd.OpenReport strDocName, acViewPreview, , _
>> "rptPaymentDueDateandDollars.Detail.Visible = False"
'
>>>gives error
>> DoCmd.OutputTo acOutputReport, strDocName, "snapshot
format",
>>>_
>> strPathAndFile
>> DoCmd.Close acReport, strDocName
>>Add the following to the report's open event.
> If MsgBox("Show detail and summary?", vbYesNo, "Confirm") =
vbNo
Then
> Me.Section(0).Visible = False
> End If
>>The user will need to respond each time the report is opened, the
default is
>>to show the detail section.- Hide quoted text -
>>- Show quoted text -
Is there any way to do it so the user doesn't have to respond? So
it
automatically creates the two reports from the one definition -
Detail, summary?
thanks -
Sara
Do it from the form that calls the report...if you have one. You
can
give the options to print or preview, summary, detail, and any
filters
from the form. In the OnOpen event of the report you can do
whatever
setting you like.- Hide quoted text -
- Show quoted text -
I don't understand. I am doing this from the form. I just want the
user to choose an option on the form and have the report run twice -
once with the detail showing and once with it hidden. How do I "set"
the Detail.Visible to False for the second run? Maybe it can't be
done. Since the user Always wants the two reports to run, I don't
want to make him click twice or choose anything - just do what he
asked me to do.
Is it possible with no user intervention?
Sara
Replace msgbox with a reference to your form's control

If Forms![YourFormName]![YourControlName] = False Then
Me.Section(0).Visible = False
EndIf

OR

Me.Section(0).Visible = Forms![YourFormName]![YourControlName]- Hide
quoted text -

- Show quoted text -

I may have spoken too soon. What is happening when I run this from my
form, is that it's not hiding the detail section, but was hiding the
form section. (I figured out how to put that back). I don't know how
to reference the report to hide the section.

Code:
strFile = "Summary " & strDocName & ".snp"
strPathAndFile = strPath & strFile
Me.Section(0).Visible = False
DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile

Forms![frmPrintPOReports].Section(0).Visible = True

I tried Reports!rptPaymentDueDateandDollars.Section(0).Vis ible =
False
but I get an error messagy saying "rptPaymentDueDateandDollars is
missing or misspelled"

Help!!!
Sara
Put the code in the Open event of the Report, not the form. It will
reference the form for the true or false to display the detail.
Sep 10 '07 #10

P: n/a
On Sep 10, 9:19 am, "paii, Ron" <n...@no.comwrote:
"sara" <saraqp...@yahoo.comwrote in message

news:11**********************@k79g2000hse.googlegr oups.com...


On Sep 7, 3:50 pm, "paii, Ron" <n...@no.comwrote:
"sara" <saraqp...@yahoo.comwrote in message
>news:11*********************@y42g2000hsy.googlegr oups.com...
On Sep 7, 2:44 pm, Salad <o...@vinegar.comwrote:
sara wrote:
On Sep 7, 1:27 pm, "paii, Ron" <n...@no.comwrote:
>"sara" <saraqp...@yahoo.comwrote in message
>news:11*********************@r34g2000hsd.googlegr oups.com...
>>Hi -
>>Is it possible to hide the detail section of a report at run
time?
>>I have a report that prints all details, with summary lines. The
user
>>would like the report ALSO with just summary lines.
>>It seems the simplest thing is to run the code (see below) once
with
>>the detail section showing, and a second time hiding the detail
>>section. I can't figure out the code to do that and don't see it
>>posted.
>>Thanks -
>>Sara
> strDocName = "rptPaymentDueDateandDollars"
> strStepErrorMsg = "Tell IT there was a problem with
Details
>>Committed Dollars Report"
> strFile = strDocName & ".snp"
> strPathAndFile = strPath & strFile
> DoCmd.OutputTo acOutputReport, strDocName, "snapshot
format",
>>_
> strPathAndFile ' works fine
> strStepErrorMsg = "Tell IT there was a problem with
Summary
>>Committed Dollars Report"
> strFile = strDocName & ".snp"
> strPathAndFile = strPath & strFile
>>' Print same report again, but hide the Detail section
> DoCmd.OpenReport strDocName, acViewPreview, , _
> "rptPaymentDueDateandDollars.Detail.Visible = False"
'
>>gives error
> DoCmd.OutputTo acOutputReport, strDocName, "snapshot
format",
>>_
> strPathAndFile
> DoCmd.Close acReport, strDocName
>Add the following to the report's open event.
If MsgBox("Show detail and summary?", vbYesNo, "Confirm") =
vbNo
Then
Me.Section(0).Visible = False
End If
>The user will need to respond each time the report is opened, the
default is
>to show the detail section.- Hide quoted text -
>- Show quoted text -
Is there any way to do it so the user doesn't have to respond? So
it
automatically creates the two reports from the one definition -
Detail, summary?
thanks -
Sara
Do it from the form that calls the report...if you have one. You
can
give the options to print or preview, summary, detail, and any
filters
from the form. In the OnOpen event of the report you can do
whatever
setting you like.- Hide quoted text -
- Show quoted text -
I don't understand. I am doing this from the form. I just want the
user to choose an option on the form and have the report run twice -
once with the detail showing and once with it hidden. How do I "set"
the Detail.Visible to False for the second run? Maybe it can't be
done. Since the user Always wants the two reports to run, I don't
want to make him click twice or choose anything - just do what he
asked me to do.
Is it possible with no user intervention?
Sara
Replace msgbox with a reference to your form's control
If Forms![YourFormName]![YourControlName] = False Then
Me.Section(0).Visible = False
EndIf
OR
Me.Section(0).Visible = Forms![YourFormName]![YourControlName]- Hide
quoted text -
- Show quoted text -
I may have spoken too soon. What is happening when I run this from my
form, is that it's not hiding the detail section, but was hiding the
form section. (I figured out how to put that back). I don't know how
to reference the report to hide the section.
Code:
strFile = "Summary " & strDocName & ".snp"
strPathAndFile = strPath & strFile
Me.Section(0).Visible = False
DoCmd.OutputTo acOutputReport, strDocName, "snapshot format",
_
strPathAndFile
Forms![frmPrintPOReports].Section(0).Visible = True
I tried Reports!rptPaymentDueDateandDollars.Section(0).Vis ible =
False
but I get an error messagy saying "rptPaymentDueDateandDollars is
missing or misspelled"
Help!!!
Sara

Put the code in the Open event of the Report, not the form. It will
reference the form for the true or false to display the detail.- Hide quoted text -

- Show quoted text -
INCredible! I love when it all works!!

Thanks so much for the help, Ron. I think I may be able to use this
concept in other places as well.

sara

Sep 10 '07 #11

This discussion thread is closed

Replies have been disabled for this discussion.