View Full Version : Showing/ Hiding controls at runtime


winshent
06-18-2008, 08:15 AM
I want to show/ hide a sub report..

I can do it easily by setting the visibility using a global variable.. eg

Private Sub Report_Open(Cancel As Integer)
Me.Controls("rptBlockWindowsDetail_Sub").Visible = gShowSubReport
end sub

I would like to control this based on the value of a checkbox.. i tried this but an error says the checkbox control has no value..

Private Sub Report_Open(Cancel As Integer)
Me.Controls("rptBlockWindowsDetail_Sub").Visible = Me.Controls("chkWindows").value
end sub

Anyone got any ideas ?

georgedwilkinson
06-18-2008, 08:31 AM
Set a default value of "True" or "False" on the checkbox object.

pbaldy
06-18-2008, 09:08 AM
You might try the format event of the section containing the controls instead of the open event.

winshent
06-19-2008, 05:08 AM
You might try the format event of the section containing the controls instead of the open event.

thanks very much...

pbaldy
06-19-2008, 08:17 AM
No problem; glad it worked for you.