Access ComboBox value returns index

Murray Brown
Murray Brown used Ask the Experts™
on
I have a ComboBox with the following RowSource. When I get its value ArmTypeCombo.Value
it shows an integer which is the index in the list rather than the text value of the column ArmType.
How can I correct this to rather show the text value?  

SELECT t_ArmType.ArmType
FROM t_ArmType
ORDER BY t_ArmType.[ArmType];
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Team Lead
Commented:
for the Combo Box control, try do the following:

1. Set Column Count = 2
2. Set Column Width = 0cm;2.54cm  (such as)
3. Set Row Source = SELECT t_ArmType.ArmTypeID, t_ArmType.ArmType FROM t_ArmType ORDER BY t_ArmType.[ArmType]; (must return 2 fields)
4. Bound Column = 1 (set this to 2 in case you wish to return Text instead)
John TsioumprisSoftware & Systems Engineer
Commented:
If you would have used the Wizard you would have seen that the scenario mentioned by Ryan is the "default" one
When you insert a combobox into your form what you actually store is the Index ...never the text...while is less eye pleasing if you open the table directly (that's why we have queries/ forms) ...all you get is a column of numbers - you can use Lookup fields but i would advise against - which is  in turn is correct ...imagine this scenario
You have to enter a number of guns placed nicely in a table Guns e.g.
1 Mugnoum 44
2. Glock 22
3 .Remington 870
....
and you are using the text return method
And you have entered one heck of entries...and you realize that Dirty Harry uses Magnum 44 not "Mugnoum 44"....so instead of having to do text replacement to correct the mistake ...you simply go to the Guns table ...you correct the mistake and now all your Queries/Forms/Reports display the correct gun....and Dirty Harry can carry on

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial