dbTalk Databases Forums  

report with one to many relationship

comp.databases.ms-access comp.databases.ms-access


Discuss report with one to many relationship in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
DJH
 
Posts: n/a

Default report with one to many relationship - 04-06-2010 , 08:31 AM






Access 2003 novice user. I am attempting to build a report using the
wizard. Table "a" has a field "barcode". Table "B" has 4 fields
"barcode1", "Barcode2", etc. I am attempting to identify the
associated name on the same row of the barcode fields in table B with
the matching barcode field in table A. I thought I built a one to
many relationship, but when I run the report it only matches one of
the fields in table "B", "barcode1" the primary key is system assigned
in "table A" What am I missing?

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: report with one to many relationship - 04-06-2010 , 09:55 AM






DJH wrote:

Quote:
Access 2003 novice user. I am attempting to build a report using the
wizard. Table "a" has a field "barcode". Table "B" has 4 fields
"barcode1", "Barcode2", etc. I am attempting to identify the
associated name on the same row of the barcode fields in table B with
the matching barcode field in table A. I thought I built a one to
many relationship, but when I run the report it only matches one of
the fields in table "B", "barcode1" the primary key is system assigned
in "table A" What am I missing?
A link?

You might have a customer order. Order #1 in field OrdNum. The order
details would have a field called OrdNum as well that would provide the
link to both tables. Thus if I set a relationship between the two
tables and there were 3 items ordered, I should see 3 rows for Order 1.

If you have a similar setup, you need to also select the fields for
Barcode1...4, not just Barcode1.

Or you code have a field called BCID in table A and then link to table
on BCID and each record have a field called BarCode.

Reply With Quote
  #3  
Old   
paii, Ron
 
Posts: n/a

Default Re: report with one to many relationship - 04-06-2010 , 10:49 AM



"DJH" <dhermus (AT) aol (DOT) com> wrote

Quote:
Access 2003 novice user. I am attempting to build a report using the
wizard. Table "a" has a field "barcode". Table "B" has 4 fields
"barcode1", "Barcode2", etc. I am attempting to identify the
associated name on the same row of the barcode fields in table B with
the matching barcode field in table A. I thought I built a one to
many relationship, but when I run the report it only matches one of
the fields in table "B", "barcode1" the primary key is system assigned
in "table A" What am I missing?
Because Table B's structure is not normalized, the wizard will not work. You
will need to edit the query, adding a reference to Table A for each barcode
field in Table B.

Example: Assuming 4 barcodes fields in Table B I used left join, assuming
some of your barcode fields are blank

SELECT TableB.Barcode1, TableA.Descriptions AS Desc1, TableB.Barcode2,
TableA_1.Descriptions AS Desc2, TableB.Barcode3, TableA_2.Descriptions AS
Desc3, TableB.Barcode4, TableA_3.Descriptions AS Desc4
FROM (((TableB LEFT JOIN TableA ON TableB.Barcode1 = TableA.Barcode) LEFT
JOIN TableA AS TableA_1 ON TableB.Barcode2 = TableA_1.Barcode) LEFT JOIN
TableA AS TableA_2 ON TableB.Barcode3 = TableA_2.Barcode) LEFT JOIN TableA
AS TableA_3 ON TableB.Barcode4 = TableA_3.Barcode;

IMO: Normalizing Table B would make your work easer

Reply With Quote
Reply




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 On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.