radio button values

Hi Guys

I have a text field with a list value(4 choices), i was using a combo box, now i want to use radio buttons, so i created an option group and the buttons, but they only take numberic values, how can i change this so if anybody click on option 1, then a text is assign to my field, not  number.

Please advise
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Insert a frame onto your form, and then place 4 radio buttons on the frame. In the frames after update event you can code a select case statement to paste a value to your text field...

sub fraframe_afterupdate()

   Select case fraFrame
      case 1

	me.txtTextfield = "option 1 Selected"

      case 2

	me.txtTextfield = "option 2 Selected"

      case 3

	me.txtTextfield = "option 3 Selected"

      case 4

	me.txtTextfield = "option 4 Selected"

    End Select

end sub

Open in new window

The OPTION GROUP is a control (just like a text box).
In the AFTER UPDATE event of this option group control.....

select case me.YourOptionGroupName
      case 1
            me.yourtextbox = "aa"
       case 2
            me.yourtextbox = "bb"
       case 3
            me.yourtextbox = "cc"
       case 4
            me.yourtextbox = "dd"
end select

Scott C
You would have to change the option groip to being unbound and then decode the number values.
Select case  myframe
case 1 then
me.textbox= "aaa"
case 2
me.textbox= "bbb"


End select

But if you store the text value then you will also have the reverse problem when you display records.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Try the switch function:
TextBox1 = Switch (optValue = 1, "Text 1", optValue = 2, "Text 2")
If options values are 1, 2, 3, ... you can use the Choose function

TextBox1 = Choose(v, "Text 1", "Text 2", "Text 3")
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
", then a text is assign to my field, not  number."

There is really no good reason to do this and it defeats the purpose and function of the Option Group.  Instead, populate your field with the option group number.  Then, whenever you need to display text related to the stored group value, you can use the Choose() function ... which is ideal for this purpose - as hnasr showed.

I agree with MX. To expand a little...
A bound option group will also display the field value in a form as you scroll through records. The text field will not update the option group on the form.
Also, storing numbers in far more efficient and better for future manipulation. (EG indexing, grouping etc).
For values like 1-4 a byte number is all that's required...
titorober23Author Commented:
What i did is this

I change the field lookup option, choose a combo box and in the row source i put this
1;Adjuvant;2;NeoAdjuvant;3;Mets;4;Adjuvant 2+ Surgeries
bound c, 1count c 2
So it will adjust the value to text before inserting it.

it is working

what do you think?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
So, you are no longer using an option group ?

titorober23Author Commented:
I am using an option group, it is just a change on the table level
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.