Code for Opening Filtered Form

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

Guest

I have three tables-Personnel, Courses, Employee Courses Completed. I have
to track all the training completed by our employees. I made a relationship
that ties them all together. I made a query (Employee Courses Status) so
that I could have a single form (also called Employee Courses Status) that
they all get entered into. This became a problem because I need an infinite
number of training entries per employee. I then made a button on my form to
open another form that lists all the training for that individual. What do I
do to make it open the form to the person I am working on? If I am working
on someone with a last name of Smith, I don't want to have to scroll through
the entire training form to find that person.
 
First, you could make the second form a subform of the first, linking the
two forms on the ID field for the person.

Another option would be to use the WHERE argument of the DoCmd.OpenForm call
when you open the other form.

DoCmd.OpenForm "OtherFormName",,,"[IDField]=" & Me.txtIDField

Use additional arguments as needed. The syntax above assumes the ID value to
be a number, if it is text, you'll need to concatenate quotes around it.
 
Back
Top