Help with disabling option group if a button is pressed

Tcmarsh43

Registered User.
Local time
Today, 13:53
Joined
Jun 16, 2014
Messages
32
I have an option group with 2 buttons in it, yes and no. It is set to default to No, but if someone hits Yes I want it to enable or turn on the next option group. Would just simply changing visible status disable it? Because I have a series of codes set up based on the second option group which read as:


Code:
Private Sub NumberOfAdditionalSites_Option1_GotFocus()
Me.AdditionalSitesLabel1.Visible = True
Me.AdditionalSitesText1.Visible = True
End Sub
 
Private Sub NumberOfAdditionalSites_Option1_LostFocus()
Me.AdditionalSitesLabel1.Visible = False
Me.AdditionalSitesText1.Visible = False
Me.AdditionalSitesLabel2.Visible = False
Me.AdditionalSitesText2.Visible = False
Me.AdditionalSitesLabel3.Visible = False
Me.AdditionalSitesText3.Visible = False
Me.AdditionalSitesLabel4.Visible = False
Me.AdditionalSitesText4.Visible = False
Me.AdditionalSitesLabel5.Visible = False
Me.AdditionalSitesText5.Visible = False
Me.AdditionalSitesLabel6.Visible = False
Me.AdditionalSitesText6.Visible = False
End Sub
 
Private Sub NumberOfAdditionalSites_Option2_GotFocus()
Me.AdditionalSitesLabel1.Visible = True
Me.AdditionalSitesText1.Visible = True
Me.AdditionalSitesLabel2.Visible = True
Me.AdditionalSitesText2.Visible = True
End Sub

I do not want these to be visible if the inital option group is still set to no. If anyone could shed some light on this I'd appreciate it, or if there is a better way to code what I already have into something more condensed that would be cool as well :) Just starting out using access so i'm a bit lost.
 
On AfterUpdate of your first group:

Code:
Me.NumberOfAdditionalSites.Visible = (Me.OriginalSite=1)

I am assuming here that your first group is called "OriginalSite" and that the value when yes is selected is "1".
 
I decided to try out,

Code:
Private Sub CheckForAdditionalSites_AfterUpdate()
Select Case CheckForAdditonalSites.Value
Case 1
Me.NumberOfAdditionalSitesFrame.Enabled = True
Case 2
Me.NumberOfAdditionalSitesFrame.Enabled = False
End Select
End Sub

Which seems to accomplish the job. Now though I am trying to get it to start out as disabled rather then having to select yes then no again to disable it. I am debating on trying something out in the on load portion. Any suggestions?
 
Thank you :) I was thinking that might be the way to go but wasn't 100%. I appreciate the help
 

Users who are viewing this thread

Back
Top Bottom