View Full Version : Option button to disable tabs on page


JDV
09-19-2007, 08:44 AM
I have a request to create option select - either drop box with YES/NO or option buttons (YES/NO). When user selects the NO option two tabs on the form should disappear (become invisible to user) so they cannot be used. How can I achieve this?
JD

boblarson
09-19-2007, 09:17 AM
In the After Update event of the Yes/No option group put:

If selecting YES from your option group is to show the tab then this is the easy code:

Me.YourTabControlName.Pages("YourPageNameHere").Visible = Me.YourYesNoOptionGroupName

pbaldy
09-19-2007, 09:19 AM
Being lazy, I've found this also works, and it's less typing:

Me.PageName.Visible = True

boblarson
09-19-2007, 09:28 AM
I goofed too - You can't use the value of the option group to set it so in the After Update event you would use (assuming that the Yes option value is really 1):

If Me.YourOptionGroup = 1 Then
Me.PageName.Visible = True
Else
Me.PageName.Visible = False
End If