Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2010
    Posts
    24

    Unanswered: Changing Text box based on combo box selection

    Hi guys,

    I have read many posts about this problem but for some reason I can't get it to work!

    Anyway, I have 2 tables...

    Table one (productdetails_tbl) contains information about the product in question, along with 2 fields about the person who completed the details sheet and their position within the company.

    In this table, the field 'Completed By' which holds the employee name has a lookup function "SELECT [Employees_tbl].[Employee] FROM Employees_tbl ORDER BY [Employee]; "

    Table two (Employees_tbl) contains the list of employees and their positions

    On my form I have the Completed By (Employee Name) combo box working perfectly and looks up the correct values.

    What I want to do it get the Position text box to automatically fill in the Position of the Employee based on the selection in the combo box.


    Any help would be greatly appreciated!

    David

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Put this line of code in the combo_xxx AfterUpdate event:
    Code:
    Me.Text_Position.Value = DLookup("Position", "Employees_Tbl", "Employee = '" & Me.Combo_xxx.Value & "'")
    You could also include the Position into the combo rowsource:
    "SELECT Employee, Position FROM Employees_tbl ORDER BY Employee;"
    Then in the combo_xxx AfterUpdate event:
    Code:
    Me.Text_Position.Value = Me.Combo_xxx.Column(1)
    Have a nice day!

  3. #3
    Join Date
    Sep 2010
    Posts
    24
    You're a star, that worked perfectly!

    Many thanks

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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