How do I use the option button to select one of two subreports?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to select one of two subreports I have in an order form, i've
tried using this code:

Private Sub Design_Frame_AfterUpdate()

Const conCatalogue_Button = 1
Const conCustomized_Button = 2

If Me!Design_Frame.Value = conCatalogue_Button Then

Order_Details1_subform.Enabled = True
Order_Details1_subform.Visible = True
Order_Details2_subform.Enabled = False
Order_Details2_subform.Visible = False

Else

Order_Details1_subform.Enabled = False
Order_Details1_subform.Visible = False
Order_Details2_subform.Enabled = False
Order_Details2_subform.Visible = False
End If

If Me!Design_Frame.Value = conCustomized_Button Then

Order_Details1_subform.Enabled = False
Order_Details1_subform.Visible = False
Order_Details2_subform.Enabled = True
Order_Details2_subform.Visible = True

Else

Order_Details1_subform.Enabled = False
Order_Details1_subform.Visible = False
Order_Details2_subform.Enabled = False
Order_Details2_subform.Visible = False
End If



End Sub


Thats to display and enable me use the first subreport and not the second,
if I select the first option and to display and enable the second report and
not the first, if I select the second.

It works with the second option, but the first option can't display the
subreport if it's selected. It displays a blank page, any help? I'm using
[Access 2000 file format], thats Office 2003.

Thank you.
 
You are mixing terminology...

Forms have subforms, not subreports.

Another approach would be to use a single subform on your main form, and use
the option group selection to set the source of that subform to one or the
other (sub)-form.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Thanks, actually I realised I had mixed up the term though at least what I
meant was understood.

Well actually, I was able to solve that problem using the tab control as a
template for the subforms and this was the code:

Private Sub Design_Frame_AfterUpdate()

Const conCatalogue_Button = 1
Const conCustomized_Button = 2

If Me!Design_Frame.Value = conCatalogue_Button Then
Page125.Visible = True
Page126.Visible = False


Else
Page125.Visible = False
Page126.Visible = False



End If

If Me!Design_Frame.Value = conCustomized_Button Then
Page126.Visible = True
Page125.Visible = False


Else
Page125.Visible = False
Page126.Visible = False

End If


End Sub
----------------------------------------------------------------------------------------------

Well its working the way I want it to with the code above but I can't seem
to get the total value from the second sub form displaying on the main form
like it does with the first.

The idea is, the overall total of either should display upon selection of
one of them.
That is the overall total of the first subform should display if thats
selected or viceversa.


Thats were I stand now.

All the same thanks for the reply.

Jeff Boyce said:
You are mixing terminology...

Forms have subforms, not subreports.

Another approach would be to use a single subform on your main form, and use
the option group selection to set the source of that subform to one or the
other (sub)-form.

Regards

Jeff Boyce
Microsoft Office/Access MVP

stripes said:
I'm trying to select one of two subreports I have in an order form, i've
tried using this code:

Private Sub Design_Frame_AfterUpdate()

Const conCatalogue_Button = 1
Const conCustomized_Button = 2

If Me!Design_Frame.Value = conCatalogue_Button Then

Order_Details1_subform.Enabled = True
Order_Details1_subform.Visible = True
Order_Details2_subform.Enabled = False
Order_Details2_subform.Visible = False

Else

Order_Details1_subform.Enabled = False
Order_Details1_subform.Visible = False
Order_Details2_subform.Enabled = False
Order_Details2_subform.Visible = False
End If

If Me!Design_Frame.Value = conCustomized_Button Then

Order_Details1_subform.Enabled = False
Order_Details1_subform.Visible = False
Order_Details2_subform.Enabled = True
Order_Details2_subform.Visible = True

Else

Order_Details1_subform.Enabled = False
Order_Details1_subform.Visible = False
Order_Details2_subform.Enabled = False
Order_Details2_subform.Visible = False
End If



End Sub


Thats to display and enable me use the first subreport and not the second,
if I select the first option and to display and enable the second report
and
not the first, if I select the second.

It works with the second option, but the first option can't display the
subreport if it's selected. It displays a blank page, any help? I'm using
[Access 2000 file format], thats Office 2003.

Thank you.
 
Back
Top