Using option buttons to select name list

Foreverlearning

New Member
Joined
Apr 4, 2004
Messages
10
:( Hi there,
I am learning to use option buttons to give the user a choice of names he may select. What I am trying to do is if a user selected option button 1 he will get a list of names NAMES1 in a text box referenced from a table, if he selected option button 2 he would get a list of names NAMES2 in the same textbox referenced from a table, now the problem is well, I can't seem to figure out how to use the code to do this. Can anybody be of assistance.

Thank you for your time. :pray:
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
You'll need a Number field in the table, called Filter. Place a 1 or 2 next to each name, depending on which list they belong to. Reason: Option buttons return an integer response by default.

Now, the pick list on the form. The control needs to be a Combo box. If it's not already, right-cllick the control in Design view and Change To | Combo Box. BTW, the field that this combo links to (its Control Source) needs a change in data type. It should be a Number, Long Integer. (Combos work on ID fields, which are usually Autonumber)
Go to the Row Source Type property (in the All tab) and select Table/Query
In the Row Source, click the ... button and build a query. You'll need the ID field for the table, the Name field, and the Filter field.
In the criteria for the Filter, place the name of the Option Group that contains your buttons -- FrameXX, where XX is the control number

Close the grid, save changes.

Now to set the columns in the combo. Adjust Column Count to 3, and the Column Widths to 0;3;0 -- this ensures that you see the Name field. Bound Column should be 1, the ID field.

Finally, when you select the option button you want the lisst to update.

Right-click the frame of the option group. Go to its Properties, Events tab, After Update event. Double-click this line. You'll see [Event Procedure]. Now click the builder (...) on that line to go to the code. Enter this line:

[Enter the name of your combo box].Requery

Give it a test drive... :biggrin:

Denis
 
Upvote 0

Forum statistics

Threads
1,221,814
Messages
6,162,135
Members
451,743
Latest member
matt3388

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top