Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2004
    Posts
    13

    Cool Unanswered: Display fields based on Combobox selection

    I created a Combobox that lists 3 fields EmpID,Firstname,Surname, from an Employee table. When user selects a record, the EmpID is stored in the field - OK so far. Is there a way I can also display (read only) the Firstname, Surname? Ideally, I will display these beneath EmpID. Therefore, essentially, I want to retrieve 3 separate fields from the Employee table based on one user selection.
    Thanks.

  2. #2
    Join Date
    Nov 2003
    Location
    LONDON
    Posts
    238
    Use the column propety of the combo box to display any of the columns in the combo box. The columns are numbered from 0 to the number of columns less 1. You would use code such as

    ' Get the third column value from the selected item in the combo box
    Me("My Text Box").Value = Me("My Combo Box").Column(2)

    Justin

  3. #3
    Join Date
    Nov 2004
    Posts
    13

    Question Display multiple fields from Combobox selection

    Thanks for replying. I inserted the code you suggested in the "After update" property of the combobox but nothing happened i.e. text box remained blank. The combobox is on a subform. Is "Me." the right thing to use? Excuse my ignorance, but I'm a newbie with access!

  4. #4
    Join Date
    Nov 2003
    Location
    LONDON
    Posts
    238
    Did you select an item from the combo box? This will trigger the afterupdate event.
    The Me property is a VBA shortcut to reference the current form/report and is correct
    Justin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •