Combo box selection sets option radio button to yes

G

Guest

I have a feeling that this question is going to be embarrassingly easy, but
here goes:
I have a combo box that when one of the selections is chosen, the option
group button for Yes is active.
I am using an If-Then statement:
If [strInsurance] = "HMO" Then
OptionYes = True

But it'snot working...any help is greatly appreciated. Thank you.
 
K

Ken Snell \(MVP\)

Set the value of the option group frame control to the number that is the
Option Value for the option button that means yes. For example, if the
option button has a value of 1, then set the frame control's value to 1.
 
G

Guest

What do you mean it doesn't work?
Do you get an error message or the check box is not set?
Where did you put this code?

Use the After Update event of the [strInsurance] combo (if you didn't
already), and write the code

Me.OptionYes = (Me.[strInsurance] = "HMO")

Does the combo has also Id to the insurance?
In that case you might need to try
Me.OptionYes = (Me.[strInsurance] = 1) ' depending on the ID of HMO
 
G

Guest

Sorry I am "painfully" new at this and I appreciate your patience. Here is
what I have so far:
Private Sub strInsurance_AfterUpdate()
If Me.strPrimaryInsurance = "HMO" Then
Me.[strAuthMedication] = "1"
Else: Me.[strAuthMedication] = " "

End If
End Sub

It is working in the sense that if I close the record and then come back in
again, then the OptionYes radio button is active (or green). But I would like
that as I enter the HMO selection from primary insurance combo box, then the
option radio button would automatically turn active. Thank you again...
--
Kbelo


Ofer Cohen said:
What do you mean it doesn't work?
Do you get an error message or the check box is not set?
Where did you put this code?

Use the After Update event of the [strInsurance] combo (if you didn't
already), and write the code

Me.OptionYes = (Me.[strInsurance] = "HMO")

Does the combo has also Id to the insurance?
In that case you might need to try
Me.OptionYes = (Me.[strInsurance] = 1) ' depending on the ID of HMO

--
Good Luck
BS"D


Kathy said:
I have a feeling that this question is going to be embarrassingly easy, but
here goes:
I have a combo box that when one of the selections is chosen, the option
group button for Yes is active.
I am using an If-Then statement:
If [strInsurance] = "HMO" Then
OptionYes = True

But it'snot working...any help is greatly appreciated. Thank you.
 
G

Guest

Private Sub strInsurance_AfterUpdate()
If Me.strPrimaryInsurance = "HMO" Then
Me.[strAuthMedication] = "1"
Else: Me.[strAuthMedication] = " "

End If
End Sub

Did you put this code on the after update event of the combo?
The name of the sub "strInsurance" is not the same as the field you
comparing the text with "strPrimaryInsurance ", it should be the same

Private Sub ComboName_AfterUpdate()
If Me.ComboName = "HMO" Then
Me.[strAuthMedication] = True
Else
Me.[strAuthMedication] = False
End If
End Sub

Or to make it shorter

Private Sub ComboName_AfterUpdate()

Me.[strAuthMedication] = (Me.ComboName = "HMO")

End Sub

***** Note *****
1. Make sure that you use this code on the after update of the combo,
2. The example I gave it say ComboName, need to be your combo name


--
Good Luck
BS"D


Kathy said:
Sorry I am "painfully" new at this and I appreciate your patience. Here is
what I have so far:
Private Sub strInsurance_AfterUpdate()
If Me.strPrimaryInsurance = "HMO" Then
Me.[strAuthMedication] = "1"
Else: Me.[strAuthMedication] = " "

End If
End Sub

It is working in the sense that if I close the record and then come back in
again, then the OptionYes radio button is active (or green). But I would like
that as I enter the HMO selection from primary insurance combo box, then the
option radio button would automatically turn active. Thank you again...
--
Kbelo


Ofer Cohen said:
What do you mean it doesn't work?
Do you get an error message or the check box is not set?
Where did you put this code?

Use the After Update event of the [strInsurance] combo (if you didn't
already), and write the code

Me.OptionYes = (Me.[strInsurance] = "HMO")

Does the combo has also Id to the insurance?
In that case you might need to try
Me.OptionYes = (Me.[strInsurance] = 1) ' depending on the ID of HMO

--
Good Luck
BS"D


Kathy said:
I have a feeling that this question is going to be embarrassingly easy, but
here goes:
I have a combo box that when one of the selections is chosen, the option
group button for Yes is active.
I am using an If-Then statement:
If [strInsurance] = "HMO" Then
OptionYes = True

But it'snot working...any help is greatly appreciated. Thank you.
 
G

Guest

One million thank yous...the problem is fixed.
--
Kbelo


Ofer Cohen said:
Private Sub strInsurance_AfterUpdate()
If Me.strPrimaryInsurance = "HMO" Then
Me.[strAuthMedication] = "1"
Else: Me.[strAuthMedication] = " "

End If
End Sub

Did you put this code on the after update event of the combo?
The name of the sub "strInsurance" is not the same as the field you
comparing the text with "strPrimaryInsurance ", it should be the same

Private Sub ComboName_AfterUpdate()
If Me.ComboName = "HMO" Then
Me.[strAuthMedication] = True
Else
Me.[strAuthMedication] = False
End If
End Sub

Or to make it shorter

Private Sub ComboName_AfterUpdate()

Me.[strAuthMedication] = (Me.ComboName = "HMO")

End Sub

***** Note *****
1. Make sure that you use this code on the after update of the combo,
2. The example I gave it say ComboName, need to be your combo name


--
Good Luck
BS"D


Kathy said:
Sorry I am "painfully" new at this and I appreciate your patience. Here is
what I have so far:
Private Sub strInsurance_AfterUpdate()
If Me.strPrimaryInsurance = "HMO" Then
Me.[strAuthMedication] = "1"
Else: Me.[strAuthMedication] = " "

End If
End Sub

It is working in the sense that if I close the record and then come back in
again, then the OptionYes radio button is active (or green). But I would like
that as I enter the HMO selection from primary insurance combo box, then the
option radio button would automatically turn active. Thank you again...
--
Kbelo


Ofer Cohen said:
What do you mean it doesn't work?
Do you get an error message or the check box is not set?
Where did you put this code?

Use the After Update event of the [strInsurance] combo (if you didn't
already), and write the code

Me.OptionYes = (Me.[strInsurance] = "HMO")

Does the combo has also Id to the insurance?
In that case you might need to try
Me.OptionYes = (Me.[strInsurance] = 1) ' depending on the ID of HMO

--
Good Luck
BS"D


:

I have a feeling that this question is going to be embarrassingly easy, but
here goes:
I have a combo box that when one of the selections is chosen, the option
group button for Yes is active.
I am using an If-Then statement:
If [strInsurance] = "HMO" Then
OptionYes = True

But it'snot working...any help is greatly appreciated. Thank you.
 

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