Combo question

Posted on 2014-08-30
Last Modified: 2014-08-30
I want a form’s combobox with its own table and query  to have its bound column to an ID number  from it’s query but display and store a description in its  control source which is one of the fields in the forms underlying table

Is that possible?
Question by:DatabaseDek
    LVL 47

    Accepted Solution

    Yes, and generally preferable.

    1.  Create your lookup table like:

    MyID - Autonumber
    MyDesc - Text

    Note: Change  "MyID" to something meaningful, but don't just use ID because after you have done this in several tables, it will get confusing

    2.  In your main table, add the MyID column to store the key to your lookup table.  DO NOT use the lookup feature in the table design, this will only confuse you later.

    3.  In your main form, add a combo box that is bound to the MyID column.  Set the following properties of the combo box:
         a.  RowSource = SELECT MyID, MyDesc FROM yourLookupTableName
    Note: you might want to add an ORDER BY clause to that to sort the results by MyDesc
         b.  BoundColumn: 1
         c.  ColumnCount: 2
         d.  ColumnWidths: 0, 1.5
    Note: adjust the 2nd column width as necessary to show all of your description

    Author Closing Comment

    Thank you.
    LVL 47

    Expert Comment

    by:Dale Fye (Access MVP)
    glad to help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
    In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now