Charts again. I have 6 (so far) chart objects on a single form. Depending on the option selected I have been using a Select Case statement and explicitly hiding or showing each chart. It runs something like this.
Code:
Case 1
Chart1.visible = True
Chart2.visible = False
Chart3.visible = False
Chart4.visible = False
Chart5.visible = False
Chart6.visible = False
Case 2
Chart1.visible = False
Chart2.visible = True
Chart3.visible = False
Chart4.visible = False
Chart5.visible = False
Chart6.visible = False
and so on. I'm trying to build a better mousetrap, but I'm stuck. Here's what I got so far.
Code:
Public Sub HideCharts(ChartID As Integer)
Dim ctl As Control
For Each ctl In Forms!frm_Chart
' ControlType captured via MsgBox
' MsgBox ctl.ControlType
If ctl.ControlType = 113 Then
If DLookup("[Graph]", "tblReports", Me.fraReports & " = [Report_ID] ") = ctl.Name Then
ctl.Visible = True
Else
ctl.Visible = True
End If
End If
Next ctl
End Sub
This works just fine, but I don't know how to turn the visible property on and off. ctl.Visible does not work. I can't see past this. I know someone knows and I think I know who it might be, but I'll take on all comers.