MS-Access 2007 ComboBox Selected Value versus Displayed Value
Posted on 2009-06-27
I have made a best effort to research a solution to my problem without success. All the solutions that I have found here on EE and elsewhere just don't fit my situation exactly. A solution to this problem should be easy to find because I would think that everybody needs it at some point in time. I'll quit whining now.
I'll use a classic metaphore to illustrate my problem though my details of implementation just have different attribute names, but the relationship is the same. Let's say I have a form where the user needs to select one of the 50 states of these here United States of America as part of an address record that is being captured for savings in a database. Because some people, myself included, can not remember the states codes for Arizonia, Arkansas, and Alaska plus they can't spell Massachusetts, Mississippi, California, or Texas correctly; so therefore I want to give them a drop down pick list; i.e. a ComboBox with the state names spelled out in full. But I want to save to the database the 2 character state codes recognized by the United States Postal Service.
In Visual Basic .NET, this is no problem because in VB.NET I can store objects in a ComboBox and set in the ComboBox the properties for the Display member and Value member of the stored object.
Thus the user sees the state name spelled out, but doesn't even see the state code that gets stored in the database.
I don't need SQL for selecting state code and state names from a table. I just need the particulars of how to use the capabilities of the ComboBox in Microsoft Access.
Thank you in advance from a marginally good VB.NET programmer.