subform

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

Guest

I have a main form and subform, the main form pulls infor from an emp query
when the emp # is typed, the subform has an emp # field that is filled in
with whatever emp# is typed in the main form. When I run a query that uses
the emp q and the badge table and I connect them by emp#, I get all the
information correct except it pulls out the same emp information on all the
records. What am I doing wrong? On my subform I have linked the parent and
child with the emp#.

Thanks.
 
Have you created a relationship between the main form's record source (I
will call it tblMain) and the subform's record source (tblSub)? If so, and
if I understand your situation correctly, it needs to be a relationship
between a primary key field in tblMain and a corresponding foreign key field
in tblSub (EmployeeID in your case, I would think). When creating the
relationship you would check the box for Enforce Referential Integrity. If
EmployeeID is the key field, and if you relate the tables one-to-many, then
the subform record will show EmployeeID in a control bound to that field.
You will not need to enter it separately in the subform. For that matter,
there is probably no real need to show it in the subform. You don't need
every possible field to appear on the form.
By the way, if your main form is based on a query, everything I have said
about relationships applies to the query's underlying table, not to the
query itself. If you create relationships between tables, queries based on
those tables will inherit the relationships.
 
Back
Top