G
Guest
I want to give the users of my report control over whether they want to view
detail or not; how can I do that
detail or not; how can I do that
neeraj said:I created a radio button on my form and it was already named as Label24. I
attempted to write this code in the 'On Open' Event of my report:
If [Forms]![Dialog Box - Report - New].[Label24] = 1 Then
Me.Detail.Visible = True
Else
Me.Detail.Visible = False
End If
But when I try to open the report from the form by choosing this report
and
supplying the other criteria required for the report, the report, it
doesn't
open. Instead it gives the runtime error no 438 and on debugging, I find
the
first line of the code (If [Forms]! ...)yellowed out.
When the code is removed, the report runs as it did before, of course,
without the option to hide detail
Linda Burnside said:On a form which will call your report, you need a radio button group.
Value
1 = show detail and value 2 for don't show detail.
VBA code for your report, On Open Event:
If Forms!yourformname.FrameX = 1 Then
Me.Detail.Visible = True
Else
Me.Detail.Visible = False
End If
Hope this gets you on the right track.
Linda
Duane Hookom said:I doubt the wizard would name a radio button something like "Label24".
You need to move your application development up a notch and "YOU" decide
the names of significant controls, not some wizard or defaults. Select your
option button control and give it a name like "optHideDetails". Then your
code will look something like:
If Forms![Dialog Box - Report - New]!optHideDetails = -1 Then
--
Duane Hookom
MS Access MVP
neeraj said:I created a radio button on my form and it was already named as Label24. I
attempted to write this code in the 'On Open' Event of my report:
If [Forms]![Dialog Box - Report - New].[Label24] = 1 Then
Me.Detail.Visible = True
Else
Me.Detail.Visible = False
End If
But when I try to open the report from the form by choosing this report
and
supplying the other criteria required for the report, the report, it
doesn't
open. Instead it gives the runtime error no 438 and on debugging, I find
the
first line of the code (If [Forms]! ...)yellowed out.
When the code is removed, the report runs as it did before, of course,
without the option to hide detail
Linda Burnside said:On a form which will call your report, you need a radio button group.
Value
1 = show detail and value 2 for don't show detail.
VBA code for your report, On Open Event:
If Forms!yourformname.FrameX = 1 Then
Me.Detail.Visible = True
Else
Me.Detail.Visible = False
End If
Hope this gets you on the right track.
Linda
I want to give the users of my report control over whether they want to
view
detail or not; how can I do that
neeraj said:I created a radio button manually, not through wizard.
Can you suggest a book on Access VBA which would have exercise data files
included. Thanks.
Duane Hookom said:I doubt the wizard would name a radio button something like "Label24".
You need to move your application development up a notch and "YOU" decide
the names of significant controls, not some wizard or defaults. Select
your
option button control and give it a name like "optHideDetails". Then your
code will look something like:
If Forms![Dialog Box - Report - New]!optHideDetails = -1 Then
--
Duane Hookom
MS Access MVP
neeraj said:I created a radio button on my form and it was already named as Label24.
I
attempted to write this code in the 'On Open' Event of my report:
If [Forms]![Dialog Box - Report - New].[Label24] = 1 Then
Me.Detail.Visible = True
Else
Me.Detail.Visible = False
End If
But when I try to open the report from the form by choosing this report
and
supplying the other criteria required for the report, the report, it
doesn't
open. Instead it gives the runtime error no 438 and on debugging, I
find
the
first line of the code (If [Forms]! ...)yellowed out.
When the code is removed, the report runs as it did before, of course,
without the option to hide detail
:
On a form which will call your report, you need a radio button group.
Value
1 = show detail and value 2 for don't show detail.
VBA code for your report, On Open Event:
If Forms!yourformname.FrameX = 1 Then
Me.Detail.Visible = True
Else
Me.Detail.Visible = False
End If
Hope this gets you on the right track.
Linda
I want to give the users of my report control over whether they want
to
view
detail or not; how can I do that