2 Lookup controls on Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KMEscherich
    New Member
    • Jun 2007
    • 69

    #1

    2 Lookup controls on Form

    Hi there, am confused. Am wondering if you have a lookup control on the form and it populates the form with the selected Employee Name and all other pertinent data, is there a way to have 2 lookup fields (one for Employee Name, and one for Employee ID) and when you make a selection from the Employee Name lookup control have it populate the form and also the Employee ID control with the correct Employee ID? Am also wondering if you make a selection from the Employee ID lookup control and have it do the same for the form fields as well as the Employee Name.


    Code:
    Private Sub Combo83_AfterUpdate()
        ' Find the record that matches the control.
        Dim rs As Object
    
        Set rs = Me.Recordset.Clone
        rs.FindFirst "[EMP_ID] = '" & Me![Combo83] & "'"
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    End Sub

    Code:
    Row Source for  Employee Name
    SELECT T_EMPLOYEE.EMP_ID, T_EMPLOYEE.EMP_NAME FROM T_EMPLOYEE;

    Code:
    Row Source for Employee ID
    SELECT T_EMPLOYEE.EMP_ID FROM T_EMPLOYEE;

    Thank you VERY much for your assistance
  • overcomer
    New Member
    • Nov 2008
    • 25

    #2
    hi

    hi,

    you may want to use cascading combo to look up the data you need base on employee id or employee name... here you''ll have to use a combo box.

    you can check the concept in the link below.

    Cascading Combo/List Boxes - bytes

    regards,
    cindy

    Comment

    Working...