Search for contact in subform

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 3 forms. Company, Department and employee. The Department form is a
subform of the company, and the employee is a subform of the department form.
This allows me to easily navigate and view all employees very quickly.
However, what i'm interested in, is to create a search option that would
allow me to enter an employee name, click on a search button which would take
me to the employee detail so I can update, edit and delete. Any suggestions?
 
See:
Filter a Form on a Field in a Subform
at:
http://allenbrowne.com/ser-28.html

The article explains how to set the RecordSource of the main form so it
contains only those records that have a match in the subform.

An alternative approach is to us a subquery in the Filter of the form.
Details in:
Subquery Basics: Filters and Searches
at:
http://allenbrowne.com/subquery-01.html#Search

If you don't want to filter the main form, you will need to write some code
to DLookup() the foreign key value of the subform's table, and then
FindFirst that record in the RecordsetClone of the main form. Details on
DLookup():
http://allenbrowne.com/casu-07.html
and example code that uses FindFirst to set the Bookmark once you have the
value to find:
http://allenbrowne.com/ser-03.html
 
Back
Top