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
titorober23Asked:
Who is Participating?
 
titorober23Connect With a Mentor Author 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?
0
 
therealmongooseConnect With a Mentor Commented:
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

0
 
clarkscottConnect With a Mentor Commented:
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
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
peter57rConnect With a Mentor Commented:
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"

etc

End select

But if you store the text value then you will also have the reverse problem when you display records.
0
 
hnasrConnect With a Mentor Commented:
Try the switch function:
TextBox1 = Switch (optValue = 1, "Text 1", optValue = 2, "Text 2")
0
 
hnasrConnect With a Mentor Commented:
If options values are 1, 2, 3, ... you can use the Choose function

TextBox1 = Choose(v, "Text 1", "Text 2", "Text 3")
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
", 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.

mx
0
 
JVWCConnect With a Mentor Commented:
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...
Cheers
JC
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
So, you are no longer using an option group ?

mx
0
 
titorober23Author Commented:
I am using an option group, it is just a change on the table level
0
All Courses

From novice to tech pro — start learning today.