A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Tying records



 
 
Thread Tools Display Modes
  #1  
Old March 20th, 2008, 08:23 PM posted to microsoft.public.access.queries
Jeff
external usenet poster
 
Posts: 82
Default Tying records

Hi

I am working on an existing database. I want to create a query which
pulls data from 2 child records of a parent. The first record in my
query would contain information frmo the first child record along with
the first child record of the other table, the second to the second,
etc.

Is there a way to do this? Could someone help?

Thanks

Jeff
  #2  
Old March 20th, 2008, 09:13 PM posted to microsoft.public.access.queries
Ron2006
external usenet poster
 
Posts: 936
Default Tying records

I am not sure I understand exactly what you are trying to receive
back.

Here is a method that may get you what you want depending on how your
tables are related.

If the child records are in the same child Table
Maintable
ID
MainTableData


ChildTable
ID
MainID
ChildType
ChildData


Query would have

main table

and the child table TWICE in the query wizard
Link the ID from the main Table to the MainID in BOTH child tables

If the child table ALWAYS have both records then leave the links as
normal
If the child table MIGHT not have one or both of the child records,
then change the links to both tables to say give you all records of
main table and those only of child table that match.

Data for the query would be

from main table
ID
MainTableData
ChildType from ChildTable 1
condition would be the type for one of the two records.
ChildDATA from childTable1

ChildType from ChildTable2
Condtion would be the type for the other of the two records
ChildData from childTable2


===========
If the child tables are two different tables everything would be the
same but the second child would simply be the second child table.

Ron
  #3  
Old March 21st, 2008, 05:33 AM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Tying records

On Thu, 20 Mar 2008 13:23:12 -0700 (PDT), Jeff wrote:

Hi

I am working on an existing database. I want to create a query which
pulls data from 2 child records of a parent. The first record in my
query would contain information frmo the first child record along with
the first child record of the other table, the second to the second,
etc.


Two child *tables* I presume?

If you're assuming that records in a table have record numbers, or that there
is a "first" and "second" record in a table, you're on the wrong track: tables
are unordered "bags" of data, not ordered rows like a spreadsheet. Do you have
some field or fields in the child tables which determine the order? Can you
reliably count on the two child tables having the same number of records for
any given parent table record? If not, what do you want to see?

Perhaps an explanation of the real-world problem here would help!
--

John W. Vinson [MVP]
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.