Lookup feild in a table

K

Keef

Hi guys,
I'm trying to create a query that looks at one table and if
there is an entry (lets say name) with an additional feild check box (result
of a yes/no entry) it looks up related data (the same name) in another table
and imports an additional feild (number). EG: if Harry is happily married
lookup harry on the other table to see how many children he has (if any) and
import this number into the query. Any ideas?

Regards
Keef
 
M

Madhivanan

Select T1.Name, T2.NooFchildren from Table1 T1, Table2 T2 where T1.Name
=T2.Name

Madhivanan
 
L

Larry Daugherty

Hi,

Are the women in this newsgroups "guys" too?

What you're describing is a one-to-many relationship between two tables. In
this case it maps perfectly because the child table has the Primary Key of
the Parent table included as a Long Integer Foreign Key. You should enforce
Referential Integrity on the tables and enable cascading deletes. Your
query would include both tables. Then, if you use the QBE grid to design
your query you'll find the relationship between PK in tblParent to the FK in
tblChild already there for you.

HTH
 

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

Top