How to lookup either value in a two column combo box?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Brad Nerbovig
    New Member
    • Nov 2010
    • 5

    #1

    How to lookup either value in a two column combo box?

    Greetings-

    I can't seem to find an answer on this one. Is it possible to lookup values in either of two columns in a combo box in Access?

    The idea is this: I have a combo box that displays an item number and an item description from an items table in the database. I'd like to give the user the option to type in a value from either one of these and go to the correct entry in the combo box. So, if they know a portion of the item name, they can enter that, or if they know the item number they can enter that. The item number gets captured and the form will display relevant data.

    I realize that I can put two different combo boxes on the form, but it would be elegant to have it all in one.

    Thanks!
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi. The data entry part of the combo is restricted to just one column, no matter how many columns you have in its underlying record source (or displayed when you drop down the row selector). Users cannot make entries in more than one column, so it is not possible to use a combo directly for what you propose.

    It is of course possible to provide the user with a textbox into which they can type an item number or part of the description, then use custom-designed VBA code to search your underlying recordset for partial matches, but this does not help you with your request re the combos.

    If you want to use a single combo you could provide the user with an option group to select the type of entry, changing the recordsource of the combo in code in response to a change in the selection made.

    There are always ways to do this kind of searching and matching, but as users can only enter data into one part of a combo this is not the answer in your case.

    -Stewart

    Comment

    • Brad Nerbovig
      New Member
      • Nov 2010
      • 5

      #3
      I figured as much, but it was worth a shot. I'll just but a text box next to the combo box with something like "Or enter any portion of the item description:". Thanks for the quick response!

      Comment

      Working...