473,377 Members | 1,151 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,377 software developers and data experts.

Hide report (detail) section via Code at Run time

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
10 11715

"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
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
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
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
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

"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
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
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

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John Baker | last post by:
Hi: Stuck on another thing. On a report I am creating, I want to make the detail section one line vertically. However, in design view, I click on the page Footer Bar ,grab it with the "double...
3
by: Melissa | last post by:
What specifically causes the Format event of a report's section to fire? Thanks! Melissa
1
by: Tom | last post by:
In the Developers Handbook, Getz provides a way to create a survey report that displays either a line, Yes/No or multiple choice for each question. It's done by placing three controls (one for each...
4
by: Lyle Fairfield | last post by:
I had a Sproc which returned a field called Details. I had the Form Wizard create a continuous form with the Sproc as the RecordSource (as a shell for me to modify). I renamed the Details...
4
by: Mal Reeve | last post by:
Hello, I have a report that has only 2 levels of grouping. The detail section is simply 1 large block for a memo field. I am finding that on some occasions the report errors and generates...
0
by: Tim Marshall | last post by:
Access 2003. A report of mine was hanging on print preview. It turned out the issue was a bound text box where the data was too big to fit all on one page. When I changed the "keep together"...
7
by: NJonge01 | last post by:
Hi, I'd like to produce a report that basically looks like an excel printout. Description: Profile Print Report Detail Section with 3 bordered text boxes all text boxes are 'abutted'...
2
by: emckesso | last post by:
Hello, I need to create conditional formatting of a text box in the detail section of a report. The formatting is based on multiple parameters that are stored in a query. For example, pretend...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.