I am trying to enable/disable a radio button based on a combo box selection (cboLocationType). The radio button is called Option New calulation. Not sure how the code should go, here is waht I have:
Private Sub cboLocationType_AfterUpdate()
Me!cboLocation = Null
If Me!cboLocationType = "Signalized Intersection" Then
Me!cboLocation.RowSource = "Intersection Data Query"
Me!OptionNewCalculation.Enabled = Yes
ElseIf Me!cboLocationType = "Time Controlled Warning Flasher" Then
Me!cboLocation.RowSource = "qryTimeUnits_Names"
Me!OptionNewCalculation.Enabled = No
Else
Me!cboLocation.RowSource = "qrySigns&FlashersNameFiltered"
Me!OptionNewCalculation.Enabled = No
End If
End Sub
At first I was using quote around the Yes/No, but I got a mismatch error. Removing the quotes stopped the error, but the code doesn't actually do anything to turn the button on or off. I have the button properties set to Enabled - Yes, which by default is what I want when the form is opened. Signalized Intersection is the default location type on form open also.
Thanks.
Private Sub cboLocationType_AfterUpdate()
Me!cboLocation = Null
If Me!cboLocationType = "Signalized Intersection" Then
Me!cboLocation.RowSource = "Intersection Data Query"
Me!OptionNewCalculation.Enabled = Yes
ElseIf Me!cboLocationType = "Time Controlled Warning Flasher" Then
Me!cboLocation.RowSource = "qryTimeUnits_Names"
Me!OptionNewCalculation.Enabled = No
Else
Me!cboLocation.RowSource = "qrySigns&FlashersNameFiltered"
Me!OptionNewCalculation.Enabled = No
End If
End Sub
At first I was using quote around the Yes/No, but I got a mismatch error. Removing the quotes stopped the error, but the code doesn't actually do anything to turn the button on or off. I have the button properties set to Enabled - Yes, which by default is what I want when the form is opened. Signalized Intersection is the default location type on form open also.
Thanks.