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 » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Many to Many Relationship Report



 
 
Thread Tools Display Modes
  #1  
Old May 17th, 2010, 08:57 PM posted to microsoft.public.access.reports
Steve D
external usenet poster
 
Posts: 48
Default Many to Many Relationship Report

Good Afternoon,
I am hoping this is possible, any help is appreciated:

I have 2 tables:

Table 1
CC# Router#
1002 1
1002 2

Table 2
CC# Switch#
1002 3
1002 4
I am trying to get:

Report 1:
1002
Router
1
2
Switch
3
4

but my query comes out:
CC# Router# Switch#
1002 1 3
1002 1 4
1002 2 3
1002 2 4

Is there a way to get this result?
--
Thank You,
Steve
Ads
  #2  
Old May 17th, 2010, 09:14 PM posted to microsoft.public.access.reports
xps35
external usenet poster
 
Posts: 22
Default Many to Many Relationship Report

=?Utf-8?B?U3RldmUgRA==?= wrote:


Good Afternoon,
I am hoping this is possible, any help is appreciated:

I have 2 tables:

Table 1
CC# Router#
1002 1
1002 2

Table 2
CC# Switch#
1002 3
1002 4
I am trying to get:

Report 1:
1002
Router
1
2
Switch
3
4

but my query comes out:
CC# Router# Switch#
1002 1 3
1002 1 4
1002 2 3
1002 2 4

Is there a way to get this result?
--
Thank You,
Steve


First of all you should consider to redesign your 2 tables to 1 one
tabel with 3 fields:
- CC#
- EquipmentType
- Equipment#

You can also "simulate" this with a UNION query:
SELECT CC#, "Router" AS EquipmentType, Router# AS Equipment# FROM T1
UNION
SELECT CC#, "Switch" AS EquipmentType, Switch# AS Equipment# FROM T2

Using this query as source for your report you can group the report by
CC# and EquipmentType.

--
Groeten,

Peter
http://access.xps350.com

  #3  
Old May 17th, 2010, 11:55 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default Many to Many Relationship Report

Steve D wrote:

Good Afternoon,
I am hoping this is possible, any help is appreciated:

I have 2 tables:

Table 1
CC# Router#
1002 1
1002 2

Table 2
CC# Switch#
1002 3
1002 4
I am trying to get:

Report 1:
1002
Router
1
2
Switch
3
4

but my query comes out:
CC# Router# Switch#
1002 1 3
1002 1 4
1002 2 3
1002 2 4


Sounds like the record source query joins the two tables
when you want a union of them:

SELECT tbl1.[CC#], tbl1.[Router#], "Router" As Device
UNION ALL
SELECT tbl2.[CC#], tbl1.[Switch#], "Switch"

The report can group on the CC# field and then on the Device
field.

--
Marsh
MVP [MS Access]
  #4  
Old May 18th, 2010, 03:02 PM posted to microsoft.public.access.reports
Steve D
external usenet poster
 
Posts: 48
Default Many to Many Relationship Report

Perfect.
--
Thank You,
Steve


"XPS35" wrote:

=?Utf-8?B?U3RldmUgRA==?= wrote:


Good Afternoon,
I am hoping this is possible, any help is appreciated:

I have 2 tables:

Table 1
CC# Router#
1002 1
1002 2

Table 2
CC# Switch#
1002 3
1002 4
I am trying to get:

Report 1:
1002
Router
1
2
Switch
3
4

but my query comes out:
CC# Router# Switch#
1002 1 3
1002 1 4
1002 2 3
1002 2 4

Is there a way to get this result?
--
Thank You,
Steve


First of all you should consider to redesign your 2 tables to 1 one
tabel with 3 fields:
- CC#
- EquipmentType
- Equipment#

You can also "simulate" this with a UNION query:
SELECT CC#, "Router" AS EquipmentType, Router# AS Equipment# FROM T1
UNION
SELECT CC#, "Switch" AS EquipmentType, Switch# AS Equipment# FROM T2

Using this query as source for your report you can group the report by
CC# and EquipmentType.

--
Groeten,

Peter
http://access.xps350.com

.

 




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 06:34 AM.


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