Option Group Source

S

shumaker

I have an option group with two Radio Buttons on a Data Entry form.
Depending on whether button 1 or 2 is selected I want to write the text
"PTN" or "BTN" to the field in the record.

I'm guessing to do this I must use some sort of switch/case to map the
values of 1 => "PTN" and 2 => "BTN".

What event should I do this in?

The form is in single form view, and users can use it to add records
only. Edit, Add, and Delete are all set to Yes, and Data Entry is set
to Yes. So they can only create new records, but they can go back and
edit/delete records they've created.

So if they arrow back a record, select a different radio button, and
then arrow forward/close/or create a new record, then the update needs
to be made to the field in the appropriate record.

I would write the numbers directly to the table, and make another table
with the value=>text mappings, but the table already has some legacy
text that I think I need to keep that doesn't fit into the categories
of radio buttons.

Thanks in advance.
 
S

shumaker

Forget it. To many problems with trying to update it myself.

A Combo box is better for this.
 
G

Guest

Actually this is not as difficult as you might think. If you still want to
try it with a Group then try this.

Place a text box control on your form and set its control source to the
field of your table where the value is to be stored. This control's visible
property can be set to not if you do not want to see it. If you want it to
show but not be changeable then just set its Locked property to true. This
would allow users to see the results of clicking the options group but not be
able to change it except by using the Group.

Next, place your group control on your form and place the two options
buttons into the group control.

The in the After Update event of the Group control, place the following code:
Select Case Me.Frame9
Case 1
Me.txtMyField.Value = "PTN"
Case 2
Me.txtMyField.Value = "BTN"
End Select

The "Frame9" is the name of the option group.
The "txtMyField" is the name of the text box you have placed on your form.

When you get this working correctly the value of the text box (and the field
in the table) will be changed each time the user makes a change to the group
control.
 

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

Similar Threads


Top