Prevent an entry on a combo box before making selection from option buttons

A

Alex Martinez

Hello,

I have a combo box, which shows names of claimants What I want is before
the user select the claimants name the user must select one of 4 option
buttons. The option buttons values are from 1 to 4. If the user try's to
click the combobox name I like to have a message box stating make you
selection choose option button 1 or 2. If the user select option 1 or
option 2 then the combobox will accept the claimant name or the user can
start to select the claimants name, but if the user select option button 3
or 4 (Value 3 & 4) then the combobox cannot be populated giving a message
saying claimant name is only available when option button 1 & 2 is select.
How can I do this. Thank you in advance.
 
T

tina

i would probably run code from the option group control's AfterUpdate event,
and the same code from the form's Current event, as

Private Sub CheckOptions()

Dim lngOption As Long
lngOption = Me!OptionGroupName

Select Case lngOption
Case 1, 2
Me!ComboboxName.Disabled = False
Case 3, 4
If Not IsNull(Me!ComboboxName) Then Me!ComboboxName = Null
Me!ComboboxName.Disabled = True
Case Else
Me!ComboboxName.Disabled = True
End Select

End Sub

call the above procedure from the option group control's AfterUpdate event,
as

Private Sub OptionGroupControlName_AfterUpdate()

CheckOptions

End Sub

and from the form's Current event, also. substitute the correct names of the
option group and combo box controls, of course.

hth
 
A

Alex Martinez

Thanks for your help Tina I will give it a try.
tina said:
i would probably run code from the option group control's AfterUpdate
event,
and the same code from the form's Current event, as

Private Sub CheckOptions()

Dim lngOption As Long
lngOption = Me!OptionGroupName

Select Case lngOption
Case 1, 2
Me!ComboboxName.Disabled = False
Case 3, 4
If Not IsNull(Me!ComboboxName) Then Me!ComboboxName = Null
Me!ComboboxName.Disabled = True
Case Else
Me!ComboboxName.Disabled = True
End Select

End Sub

call the above procedure from the option group control's AfterUpdate
event,
as

Private Sub OptionGroupControlName_AfterUpdate()

CheckOptions

End Sub

and from the form's Current event, also. substitute the correct names of
the
option group and combo box controls, of course.

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top