Ernie, I posted this in a parallel reply:
Private Sub Report_Open(Cancel As Integer)
Const strcForm As String = "frmReport"
If CurrentProject.AllForms(strcForm).IsLoaded Then
Me.Section(acDetail).Visible = _
Nz(Forms(strcForm)!chkShowDetail.Value, False)
End If
End Sub
Replace "frmReport" with the name of your form, and chkShowDetail with the
name of your checkbox.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
Ernie Sersen said:
I added the statement Me.[Detail Sub].Visible = Me.OpenArgs into the On
Open
statement of the report and I get the error message "Run-time error
'2465':
Microsoft Office Access can't find the field '|' referred to in your
expression. Again, should I be substituting the name of the Sub in this
statement (i.e. Control name = DispSum_Click() ?
In your other post, Allen, I'm not sure what I have to substitute in your
code. Form name is InvForm, Check box on form is InvSumCheck, and Report
is
InvReport. Can you help me fill in the blanks?
Allen Browne said:
I think Ofer intended to write that the line of code goes in the Open
event
of the *report*.
You will need Access 2002 or 2003 to get this OpenArgs approach to work.
I am getting an error when I code the OnOpen of the form:
Me.[Detail Sub].Visible = Me.OpenArgs
Should I be substituting the Sub with the name of the control
'DispSum_Click()'
i.e. Me.[Detail DispSum_Click()].Visible = Me.OpenArgs
:
You cab use the OpenArgs of the open report command line
From the button you want to display the sub write
Docmd.OpenReport "ReportName" , , , , ,True
And from the other
Docmd.OpenReport "ReportName" , , , , ,False
On the OnOpen event of the form write the code
Me.[Detail Sub].Visible = Me.OpenArgs
--
Good Luck
BS"D
:
I have a report with a summary header and a detail section. I don't
want to
have to create two reports (one that shows just the summary data and
one that
shows both summary and detail data). Is there a way to use the same
report
accessible by two buttons on my form that when clicking the first
button, the
summary data displays and when clicking the second button, both the
summary
and detail data displays?