Question

Report grouping from Query source with Ambiguous Outer Joins

Asked by: Zyphon09

Hi

I am trying to group an Access Report into groups and I am not having much luck in succeeding.

I had asked for some help here on EE and an expert was kind enough to help me out with my table/form design. My Access skills are very much that of a beginner.

That post can be viewed here.
http://www.experts-exchange.com/Microsoft/Development/MS_Access/Access_Architecture-Design/Q_24728150.html

However I have encountered a problem with a report I am trying to run. I wanted to use a Query to join all the tables as a source for my report. However Access reported an error stating that I had an Ambiguous Outer Joins.

I did some research on the web to discover what this meant by this and made 3 Queries to perform a Query Joins to try to overcome this problem.

I now do not get the error any more when I run the Query and I was able to use it in my report.

The Problem I have now is that although the fields work I get duplicate values in the report when trying to group sections.

I have attached a sample to show what I have done. I am trying to replicate the grouping as in the form: 'frmMeetings'.

I created 3 queries called 'qryTest 1,2 & 3', also query 'qryForPrintMinutes' was another test.

The test Reports are: 'qryForPrintMinutes', 'qryTest3', 'qryTest4' although the latter two are the more recent attempts.

What i am trying to achieve is in the Sessions section group this by date order and then a list of Attendees and then their notes for this session beneath this.

I end up with a lot of repeats and I cannot work out where I am going wrong.

I am using Access 2007 but the DB needs to be compatible with 2003.

Would someone please be kind enough to look at my db and advise me on where I am going wrong.

Thanks.
Michael :)

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-11-01 at 15:24:50ID24862447
Tags

Grouping Access Reports

,

Access 2007

Topic

Access Architecture/Design

Participating Experts
3
Points
500
Comments
25

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Ambiguous Outer Joins
    I do a report periodically that uses 3 semesters of course failure data. The data for each semester is brought into Access as a separate table: e.g., Jan01, Jun01, Jan02. The report will use several fields from the current table—in this case, Jan02—and one field from each o...
  2. Ambiguous Errors
    Hello Freinds, i have been getting this Complier Error Message: BC30560 'ReportDataSource' is ambiguous in the namespace 'Microsoft.Reporting.Webforms' I googled to find the solution and found it is because of the version difference. The project was created in visual studio ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: Helen_FeddemaPosted on 2009-11-01 at 16:24:57ID: 25716336

It is confusing to have a report with the qry prefix, so I recommend renaming the report rptForPrintMinutes.  The duplicates can be suppressed by setting HideDuplicates to Yes for most (if not all) of the fields.  However, I think you might be better off with Meeting ID as the top-level group, since it is the "one" table in relationship to Session and Status.  Also, the report is much too wide (even for Legal Landscape paper) -- it needs to be made more compact.
Generally speaking, the fields should be in order of the groups, so I would put Meeting first, then Session or Status, then Start Date (or whichever date field you want to sort by).
You only have one Meeting record, which makes it rather difficult to test the report.

 

by: boag2000Posted on 2009-11-01 at 18:29:30ID: 25716748

Take heed to Helen's advice.

If you "Grouped" the report, then duplicates would not be an issue.
For example, if you grouped an Order's report by State, then all the Orders in NY would be listed under "One" state heading (NY).
Thus there is no need to repeat NY for ever single record.
The same would be true for every other State.
They would each have their own grouping.

Check out the Northwind Sample database:
http://www.microsoft.com/downloadS/details.aspx?FamilyID=c6661372-8dbe-422b-8676-c632d66c529c&displaylang=en
...and look at the "Orders" table.

Play around with creating "Grouped" reports using the Report Wizard.with this table:
Group by Customer
Group by Order
Group By Shipper
Group By Country
Group By Employee (First level Group) and in the same report, also group by CustomerID (Second Level Group).
...etc

You will begin to get a feel for how these report are created and what they will look like.

Here is a great reference book of Creating Reports in MS Access:
http://www.amazon.com/Microsoft-Office-Access-Reports-Queries/dp/0789736691/ref=sr_1_1?ie=UTF8&s=books&qid=1257128852&sr=1-1

;-)

JeffCoachman

 

by: harfangPosted on 2009-11-01 at 19:48:54ID: 25716973

Hi,

You are confused by many-to-many relationships. That is quite normal.

If you look at your form, you have meetings, linked to sessions, in turn lined both to attendees and to notes. Each link is represented by the link fields of a subform. So you have two subforms on the subform 'sessions'.

    meetings  1-n  sessions  1-n  attendees
                                            1-n  notes

If you want to create a report with a single query, you can choose only one path, either attendees or notes. If you want both, imagine the problem: you have three people and five notes. You ask Jet to combine these in a single table. Jet will be happy to comply, giving one copy of each note to each person. In other words you get 15 rows, showing all possible person-note pairs.

Technically, this is called a "Cartesian product"; everybody gets bitten the first time, but it's in fact both logical and useful in many situations (not this one).

If you add a relationship to your table structure, for example that each note is signed by one of the attendees, you could use this:

    meetings  1-n  sessions  1-n  attendees  1-n  notes

That can be displayed with a report having a single query: the notes will be placed under each attendee having signed them. But this isn't the layout you want.

Start for example with this query:

    meetings  1-n  sessions  1-n  attendees

Once you are happy with the result, and are ready to add the notes below the list of attendees, create a subreport. It should be placed in the footer of the 'sessions' group, below the 'attendees' details, linked (just like the forms) through Session.SessionID to Notes.SessionID.

You can also do the opposite, start with

    meetings  1-n  sessions  1-n  notes

And add a subreport to show attendees in the group header of the 'sessions' group, above the 'notes' details.

Does that make sense?
(°v°)

 

by: harfangPosted on 2009-11-01 at 19:55:24ID: 25716989

Afterthought:

Your structure is ideal to show one useful aspect of the Cartesian product. If you were to add a button on your subform 'session' to print the notes, on on each page, you could do exactly that: add both the related notes and the related attendees to your query. This would print out 15 pages (the five notes for the three attendees), exactly the right number.

Your current reports try to do just that: print the 15 needed copies of the notes.

(°v°)

 

by: Zyphon09Posted on 2009-11-02 at 13:39:25ID: 25724041

@Helen_Feddema

Apologies for my Report naming, as they were based on my Queries I forgot to rename them with the rpt prefix.

I did try using the Meeting ID as the top grouping but it still didn't work for me, am I going about joining via Queries? If I do not use linked Queries then I get the 'ambiguous outer join error'.

QryTest3 incorporates QryTest2 and QryTest3. Thanks for the good advice. I think harfang nailed it when he said about the "Cartesian product".

@boag2000

Thanks for you help and advice. There must be something wrong with my Query. When I run the Report Wizard I don't get the option: 'How do you want to view your data?'. Instead the wizard goes straight to the 'Do you want to add any grouping levels?'. If I add MeetingID then I don't get any of the other fields pulled through and grouped with it and it ends up as an orphan.

@harfang

Thanks for your help. I am really having trouble getting my head around how to prepare the source for the Report. The relationships in the DB is set in a way that causes errors when trying to write a Report.

To be honest I am all but ready to give up the ghost as I cannot seem to find a way around the querky tables setup and I thought that linking through Queries would have resolved that but the "Cartesian product" you mentioned is obviously causing a problem and I don't know how to get around this, I guess I have to go back to the drawing board and try research "Cartesian product" on Google and see what comes back.

Even after all the advice given here I am none the wiser, I guess I need get past the whole "Cartesian product".

 

by: harfangPosted on 2009-11-02 at 14:26:56ID: 25724455

Thanks for the detailed feedback. I with more Askers would take the time to do the same.

Don't get too hang up on the whole Cartesian product issue. Just accept is as the reason why you can't use a single report to show both the attendees and the notes of a session. Bottom line: you can't prepare a single source for everything, no matter how you massage the data. Either attendees or notes (or both) must be displayed as a sub-report. It's not hard to do, it's just like sub-forms.

Cheers!
(°v°)

 

by: Zyphon09Posted on 2009-11-02 at 15:07:46ID: 25724736

Thanks for  your advice harfang. So I need to research sub-reports? I shall look into this. I must admit it is very difficult being a noob and trying to learn all the features of Access. I guess I need to learn to walk before I run.

Thank you for your guidance it was most useful. I shall have another crack at the Report.

I did try editing the relationships in the Query but this didn't work either.

I found some really useful information in the link below regarding Cartesian product. I shall study it further.

http://www.databasedev.co.uk/multiple_table_queries.html

 

by: boag2000Posted on 2009-11-02 at 17:24:00ID: 25725426

<I don't get the option: 'How do you want to view your data?'. Instead the wizard goes straight to the 'Do you want to add any grouping levels?'. If I add MeetingID then I don't get any of the other fields pulled through and grouped with it and it ends up as an orphan.>

...I'm not sure what this means, or what happened..

<I don't get any of the other fields pulled through and grouped with it and it ends up as an orphan>

...Are you saying that this is what the report looked like when you finished the wizard a viewed it?

Can you post a graphical example of what you want the report to look like based on the sample data?

Jeff

 

by: Helen_FeddemaPosted on 2009-11-03 at 07:39:57ID: 25729986

Your query looked OK, so I agree with boag, a picture of what you want in the report would be very helpful.  I am sure it can be done.

 

by: Zyphon09Posted on 2009-11-03 at 14:31:34ID: 25734556

Hi Helen and Jeff, thanks again for your advice and help.

I have uploaded another sample and I have made the changes that Helen suggested I have renamed the reports so that they have the correct rpt prefix and not the qry. I have also created an extra meeting which also has two sessions which may help with Report grouping.

What I have done is make a mock up Report which is basically many labels and I manually typed in the text. I created page breaks to demonstrate how I envision how the report should look if possible.

The test report that I created is the one called 'rptReportMockUp4EE' I hope it makes sense.

Thanks again for your help.

 

by: boag2000Posted on 2009-11-03 at 18:01:46ID: 25735771

And just for clarity, ...what Table/Query is to be the source for this report?

 

by: harfangPosted on 2009-11-04 at 03:11:05ID: 25738125

Hello

Please find attached the report rptSessions, using subreport rptAttendees: import both reports into your database.

The design is very basic, it simply demonstrates how the main report can handle meetings, sessions, and notes, while the subreport handles attendees and people.

I hope this clarifies my earlier postings
(°v°)

 

by: Zyphon09Posted on 2009-11-04 at 06:32:26ID: 25739610

I did use Query: 'qryForPrintMinutes' but the latest query I created was: 'qryTest3' and I had hoped that this would be the best.

The report: 'rptTest4' was the nearest I could get to what I required but it is not quite right.

I hope this helps.

Thanks.

 

by: harfangPosted on 2009-11-04 at 07:11:08ID: 25740074

Did you try importing the reports from my previous post? -- (°v°)

 

by: Zyphon09Posted on 2009-11-04 at 07:39:00ID: 25740385

@harfang

This is fantastic! Thank you very much This is exactly the layout I wanted.

What did you use as the source for both reports? was it my 'qryTest3'?

I have also found a few sites that explain subreports and their similarity to subforms.

Thanks again for your help.

 

by: Zyphon09Posted on 2009-11-04 at 07:57:05ID: 25740606

Another question, on my subform sometimes the navigation buttons disappear or when they do appear if if I click the next record to show the next session the top line of my subform disappears. The line that has the session start, end and room location. No matter how I try to resize the subform I cannot seem to correct this issue. What am I doing wrong?

 

by: Zyphon09Posted on 2009-11-04 at 08:03:46ID: 25740677

Ignore my previous comment about the subform I seem to have resolved it.

 

by: harfangPosted on 2009-11-04 at 13:55:32ID: 25744390

> What did you use as the source for both reports?

The queries are embedded in the reports, see the record source property. The main report links meeting to sessions and notes, the subreport links attendees to people.

I'm glad you liked it, and believe me there is way to produce this with a single query / report.

Cheers!
(°v°)

 

by: Zyphon09Posted on 2009-11-04 at 14:50:19ID: 25744933

Thanks again for the additional information. I checked the record source property and although I don't fully understand how that works in certainly looks interesting.

>'m glad you liked it, and believe me there is way to produce this with a single query / report.

Would this be from one of the queries that I already have in the database or would  you need to make a new one?

I am intrigued and would love to know how but my skills are very limited. I am very grateful for your help I am learning all the time.

Many thanks.

Michael

 

by: harfangPosted on 2009-11-04 at 15:05:28ID: 25745064

My lazy fingers! please read "there is NO way to..." I was trying to reassure you once more that you will need at least one subreport to avoid the "Cartesian product" syndrome. Your query attempts weren't deficient in any way, but the task was impossible.

(°v°)

 

by: Zyphon09Posted on 2009-11-05 at 00:55:37ID: 25747683

Oh I see. Thank you very much for clearing that up for me, that vital piece of information will help me greatly in the future. At least I now know it cannot be done in one step. Also learning about the "Cartesian product" syndrome has opened my eyes also so than you so much for that piece of info.

Thank you all for your help, I really appreciate it. Now I need to go off and practice some more with Reports and Queries.

Kind regards
Michael

 

by: Zyphon09Posted on 2009-11-05 at 01:01:05ID: 31648650

I have been priviledged to receive expert information from the 3 experts in my thread. I have learned a lot of new information which will arm me in the future with regards to relationships, queries and reports with subreports. I am very grateful to all. Thank you.

 

by: harfangPosted on 2009-11-05 at 03:17:15ID: 25748339

You are very welcome.

Re-reading, I notice that the question's title, ambiguous joins, has not been properly addressed. Let's take a three table query like this:

    Sessions  1--n  Attendees  n--1  People

This is a typical many-to-many relationship. There can be many attendees per session (1--n) and many attended sessions per person (1--n), so there can be many sessions per person and many people per session (n--n). The table attendees creates this many-to-many relationship between both "parents".

For comparison, this is a "Cartesian product" query, by reversing the direction of the one-to-many (many-to-one?) relationships:

    Attendees  n--1  Sessions  1--n  Notes

This is a distribution list: each attendee get a copy of every sessions' notes. The "parent" table is in the middle.

Going back to the first query, if you want to see all sessions, even those for which not attendees have been entered yet, you need a LEFT JOIN, often shown as an arrow:

    Sessions  --->  Attendees  --->  People

You could reverse it to see all People, even those not scheduled to attend any meeting. What you can't do is see all sessions and all people:

    Sessions  --->  Attendees  <---  People

That's an "ambiguous join". The Jet Engine needs to start exploring from one "root" table, and follow the arrows from that root. If there are two or more "roots", it finds the query "ambiguous", and tells you so.

The following is legal, and it's equivalent to the default INNER JOIN query, because there are no unmatched records in the table Attendees (they always have two parent records).

    Sessions  <---  Attendees  --->  People

The query in the report is basically

    Meetings ---> Sessions ---> Notes
    [subreport:]                 \---> Attendees --- People

(All meetings, even those without a planned session; all sessions, even those without notes; plus an attendance list if available) You could also use:

    (Meetings --- Sessions) ---> Notes

(All sessions and related notes, but no meetings without a scheduled session.) This wouldn't be ambiguous either.


Thanks and success with your project!
(°v°)

 

by: boag2000Posted on 2009-11-05 at 07:05:33ID: 25750191

;-)

 

by: Zyphon09Posted on 2009-11-05 at 14:11:54ID: 25754621

Hi harfang

Thanks for all the additional info you supplied in your last post. You really have gone above and beyond in educating me with relationship and further info regarding "Cartesian product". Many thanks for taking the time to explain this to me I have learned a lot here and I shall try and take that away with me and become a better designer.

Thanks all for your help. :)

Kind regards,
Michael

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...