By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,988 Members | 1,367 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,988 IT Pros & Developers. It's quick & easy.

Parent-Child Relation

smartchap
100+
P: 236
I have a database (in access) having 3 tables: Parent, Child1 & Child2. All the 3 tables have a common field 'PersonID'. Parent table has, say, 10 records having PersonID 1 to 10. Child1 has, say 3 records all having same PersonID, say 5. Child2 has , say 2 records, all having same PersonID, say 5. I want to create a report using DataReport (may be wiith DataEnvironment also) in VB6. The output in report should be like below:
Record1 of Parent
Record2 of Parent
.
.
Record5 of Parent
Record1 of Child1
Record2 of Child1
Record3 of Child1
Record1 of Child2
Record2 of Child2
Record6 of Parent
.
.
Record10 of Parent

For this I think I have to use Shape, Append & Relate commands in the form but don't know how to relate TWO child tables with Parent table.
Please help me.
Thanks in advance.

Always Believe in GOD!
Jan 29 '08 #1
Share this Question
Share on Google+
6 Replies


debasisdas
Expert 5K+
P: 8,127
simply try to use UNION in sql.
Jan 29 '08 #2

Expert 5K+
P: 8,434
simply try to use UNION in sql.
Yes, you can UNION the two child tables so they look like one big one.
Jan 29 '08 #3

smartchap
100+
P: 236
Dear debasisdas and killer42
UNION is used when both the tables have similar fields. But in my case they have different different fields.
I used SHAPE command with APPEND and RELATE, it works well with 1 parent & 1 child table, but don't know how to use with one parent & two child tables.
If there is any other method please help.
Jan 30 '08 #4

debasisdas
Expert 5K+
P: 8,127
Since you are selecting one particular field only that should not be a problem.

Only they must have same datatype .
Jan 30 '08 #5

Expert 5K+
P: 8,434
I used SHAPE command with APPEND and RELATE, it works well with 1 parent & 1 child table, but don't know how to use with one parent & two child tables. If there is any other method please help.
Sorry, you've gone way beyond my SQL knowledge now. I've never even seen SHAPE or RELATE.
I hope someone else here can help. Also, I'd recommend posting your question in the Access forum, as the real database experts tend to hang around over there.
Jan 30 '08 #6

smartchap
100+
P: 236
Dear debasisdas
All the tables have different different fields and have only one common field PersonID.
Feb 1 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.