VBA Access combo box

c_reynolds

New Member
Joined
Jan 8, 2015
Messages
6
Can anyone assist me? I have a combo box and I am trying to get it to display the selection for that row. Every time a selection is made,it populates the entire form with that selection. Any suggestions? Also, the values are from a Value List.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Sounds to me like you have an unbound combo box, and you have put it in a multi-record form.
Unfortunately, unbound controls do that. It's actually a design feature; because unbound controls are not connected to any particular record, all records in the form see the same value. That is what makes them so useful for searching or filtering.

To have a bound combo, you need to go to its properties and, in the Data tab, put a field name in the Control Source row. You should have a drop-down list of the available fields.
Be aware, though, that by default the data in the FIRST column of the combo (visible or not) is what gets stored in the field. So, if you have hidden ID and a visible text field, Access stores the hidden ID. Make sure your data types match.

BTW, you may find this useful: http://www.datawright.com.au/access_resources/access_combo_boxes.htm#combo_create

Denis
 
Upvote 0
Thank you SydneyGeek, however, when I try to bound the combo I keep getting an issue because there are 2 options in the dropdown, but only 1 checkbox in the table. For example, the field that the combo needs to be bound to is called Reviewed and the options in the dropdown are Reviewed and Pending. How can I get the combo to bound to that field without issue? The Data Type for the field is Yes/No. Can you help me with this?
 
Upvote 0
I guess it depends on your workflow. Can an item be both Reviewed and Pending? And if not, is there maybe a third option such as In Progress?
Something like an option group might be easier to use. You can see all 3 options (in this case) but only one can be selected. To make that work you need to bind it to a number field because the result of an option selection is always an index number (1 for the first item, 2 for the second, etc).
The other possibility is to have 2 Yes/No fields, one for each option. That works if you could have both things selected at once, and it's more direct than a combo in this case.

Denis
 
Upvote 0
SyndeyGeek, the option group will not work because it does not offer a dropdown. Do you have another suggestion?
 
Upvote 0
Do you need a dropdown? The option group is an effective way to let users pick one of a few possibilities, without needing to use a drop down first.
And trying to use a checkbox to the output of the dropdown just adds complexity.
If you want to use a combo, you can store any one of many options in a single field but it needs to be a number (if you have a hidden ID field as the first column) or text (if it's a single column combo and you are storing the descriptive text). Instead of having a Reviewed (yes/No) field, use a Status (Text) field and you should get what you need.

Denis
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,119
Members
452,381
Latest member
Nova88

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