Trying to combine multiple records into one record in a Query

R

Rich/rerat

I am new to Access, and very little knowledge about SQL. I read allot about
normalization, need to know if I went to far with it with my Family table.
Here is the structures for the tables I have, and of the query I want to
create.

Contact Table:
tabContactID (Autonumber)
ContactID (Create using VBA in a form) (PK)
FirstName
LastName
etc....

Example:
tabContactID ContactID FirstName LastName etc....
0001 DonDuck Donald Duck
0002 MicMouse Mickey Mouse


Next the Family Table:
tabFamID (Autonumber)(PK)
ContactID (FK from Contact Table)
FirstName
LastName
FamRelshp
Birthdate

Example:

tabFamID ContactID FirstName LastName FamRelshp Birthdate
0001 DonDuck Daisey Duck Spouse
0002 DonDuck Huey Duck Chld1
0003 DonDuck Dewey Duck Chld2
0004 DonDuck Lewey Duck Chld3
0005 MickMouse Minnie Mouse Spouse

I would like to be able to create a Query, creating a single record for each
family, using the multiple records based on the same field, ContactID.

A Query with each record as follows:
ContactID
SpouseFN
SpouseLN
SpouseBirth
Chld1FN
Chld1LN
Chld1Birth
etc...

Or should I just set up the Family table like the above query.
 
M

Marshall Barton

Rich/rerat said:
I am new to Access, and very little knowledge about SQL. I read allot about
normalization, need to know if I went to far with it with my Family table.

No, you did not go too far.
Here is the structures for the tables I have, and of the query I want to
create.

Contact Table:
tabContactID (Autonumber)
ContactID (Create using VBA in a form) (PK)
FirstName
LastName
etc....

That tabContactID field is not serving any purpose and
should be deleted. Just make sure you can differentiate two
ContactIDs for different folks with similar names (eg.
Michel Mouse, unrelated to Mickey).
Example:
tabContactID ContactID FirstName LastName etc....
0001 DonDuck Donald Duck
0002 MicMouse Mickey Mouse


Next the Family Table:
tabFamID (Autonumber)(PK)
ContactID (FK from Contact Table)
FirstName
LastName
FamRelshp
Birthdate

Example:

tabFamID ContactID FirstName LastName FamRelshp Birthdate
0001 DonDuck Daisey Duck Spouse
0002 DonDuck Huey Duck Chld1
0003 DonDuck Dewey Duck Chld2
0004 DonDuck Lewey Duck Chld3
0005 MickMouse Minnie Mouse Spouse

I would like to be able to create a Query, creating a single record for each
family, using the multiple records based on the same field, ContactID.

A Query with each record as follows:
ContactID
SpouseFN
SpouseLN
SpouseBirth
Chld1FN
Chld1LN
Chld1Birth
etc...

Or should I just set up the Family table like the above query.

No, leave the tables as is.

Take a step back and rethink why you want to have such a
query. You can easily display the family data using a
subform or subreport without using that kind of query so I
don't see any reason for what you think you want to do.
 

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