James C. said:
I have an option group of 4 different choices (Source Report,
Destination Report, Special Report, Origin Report)
The values set for these are 0,1,2,3
On my form I have labels and dropdown boxes that I want to appear
when a certain choice is selected. Right now I have the visible
feature on all of these set to false. Where do I go to say "if Source
report option selected then make labelX.visible = true"
Use the AfterUdate event of the option group frame. You don't give the
names of the controls involved, but the code might look something like
this:
'----- start of example code -----
Private Sub optReportType_AfterUpdate()
Select Case Me!optReportType
Case 0
Me!lblSourceRpt.Visible = True
Me!lblDestRpt.Visible = False
Me!lblSpecialRpt.Visible = False
Me!lblOriginRpt.Visible = False
Case 1
Me!lblSourceRpt.Visible = False
Me!lblDestRpt.Visible = True
Me!lblSpecialRpt.Visible = False
Me!lblOriginRpt.Visible = False
Case 2
Me!lblSourceRpt.Visible = False
Me!lblDestRpt.Visible = False
Me!lblSpecialRpt.Visible = True
Me!lblOriginRpt.Visible = False
Case 3
Me!lblSourceRpt.Visible = False
Me!lblDestRpt.Visible = False
Me!lblSpecialRpt.Visible = False
Me!lblOriginRpt.Visible = True
Case Else
Me!lblSourceRpt.Visible = False
Me!lblDestRpt.Visible = False
Me!lblSpecialRpt.Visible = False
Me!lblOriginRpt.Visible = False
End Select
End Sub
'----- end of example code -----
If the option group is a bound control, then you'll also want to call
its AfterUdate event procedure from the form's Current event, so that
the other control are shown or hidden appropriately as you navigate from
record to record.
If you have whole sets of controls that should be visible or hidden
based on this option group, you may find it more efficient to group them
together somehow -- maybe using their Tag properties, or with an array
of control names -- so that you can loop through controls without having
to name each one in a separate code line.
Note also that you can't hide a control that has the focus. Therefore,
if any of the controls might have the focus, you must set the focus
elsewhere before hiding it.