2
votes

I have created a form with radio buttons in it.

It takes input of the gender of the person and stores it in a table. I want it to store the text "Male" when male is chosen and the text "Female" when female is chosen.

I was unable to do this as when I tried, I was not able to change the value of the option, it takes it as an integer 1,2,3...

In the properties of the button, in the data tab, I have tried changing the option value to "male" and "female" for their respective buttons, but they keep changing back to 1 and 2

I want this to be a text which will go into the database. I have tried doing this, but the data value of the option doesn't seem to change.

Anybody know how to do this??

Regards, Amir

1

1 Answers

3
votes

Probably the easiest way would be to unbind your option buttons and create a hidden textbox for gender, then, using the After Update event for the Option Group, update the hidden textbox.

Select Case Me.Options
    Case 1
       Me.Gender = "Male"
    Case 2
       Me.Gender = "Female"
    Case Else
       Me.Gender = "N/A"
End Select

In the Current event for the form, you can do the reverse:

Select Case Me.Gender
    Case "Male"
       Me.Options = 1
    Case "Female"
       Me.Options = 2
    Case Else
       Me.Options = 3
End Select