subform

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.
 
B

BruceM

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

subform infor 1
Populate info 1
filling in data 4
information problem 3
how to calculate days 3
tab control in form 1
please please I Need A Code For This Question Very Important 1
please please help me 1

Top