Connecting Tech Pros Worldwide Forums | Help | Site Map

2 Lookup controls on Form

Member
 
Join Date: Jun 2007
Posts: 64
#1: Nov 21 '08
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.


Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo83_AfterUpdate()
  2.     ' Find the record that matches the control.
  3.     Dim rs As Object
  4.  
  5.     Set rs = Me.Recordset.Clone
  6.     rs.FindFirst "[EMP_ID] = '" & Me![Combo83] & "'"
  7.     If Not rs.EOF Then Me.Bookmark = rs.Bookmark
  8. End Sub
  9.  

Expand|Select|Wrap|Line Numbers
  1. Row Source for  Employee Name
  2. SELECT T_EMPLOYEE.EMP_ID, T_EMPLOYEE.EMP_NAME FROM T_EMPLOYEE; 
  3.  

Expand|Select|Wrap|Line Numbers
  1. Row Source for Employee ID
  2. SELECT T_EMPLOYEE.EMP_ID FROM T_EMPLOYEE; 
  3.  

Thank you VERY much for your assistance

overcomer's Avatar
Newbie
 
Join Date: Nov 2008
Location: Manila
Posts: 25
#2: Nov 25 '08

re: 2 Lookup controls on Form


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
Reply