Solved

Query Displays 4 copies of a record

Posted on 2011-09-07
5
389 Views
Last Modified: 2013-11-27
Great Day,

I am trying to print an invoice report for a customer who has had service performed on his/her car. the query may be more complicated than it needs to be, but I have enclosed the query and all of the associated tables. When I run the query, it appears as if numerous copies of each record are being displayed, and when I add tblParts, which I need, the query does not return any records. When you open the Query design of 'Copy Of rptInvoice Backup query' you will see that I have not added tblParts.

I need assistance with two issues relative to this query:

1. Why is it returning multiple copies of the same record?
2. Why does it not return any records when tblParts is added?

BTW, I need to add the field named 'Part' to the query from tblParts.

Thanks in advance for the assistance.

r/David
PrintInvoice.zip
0
Comment
Question by:yddadsjd95
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
BusyMama earned 500 total points
ID: 36496463
When you add the table Parts the query displays nothing because there is a defined inner join between Part and Repair Order, but the Part Type ID in the Repair Order table is null.  Since there aren't any matches, it results in nothing in the query.  Because you are using all inner joins, the query will only return records where ALL inner join criteria exist.

There are multiple copies of the records because the prices are different.  You either need to remove the columns from the query that are different (and probably put the word DISTINCT after the word SELECT in the SQL view of the query), or add up the totals and group by the remaining columns in the query if you only want one row per person.

This is a LOT of tables and joins for one query, I would suggest you rethink that to make sure you are always getting what you need.
0
 

Author Comment

by:yddadsjd95
ID: 36496520
Busy Mama, Thank you for getting back to me. You've given me a nice little assignment here, I am not quite new to Access, but I don't use it too often, so I'll work with it and get back to you.

Oh, if I need something from all of the tables, how do I get around the number of tables and joins without adding them to the Query?

r/David
0
 
LVL 7

Assisted Solution

by:BusyMama
BusyMama earned 500 total points
ID: 36496596
If you need something from all the tables you either have to do it the way you are, or you have to split it up into several different queries.  For example, I used to do a "Make Table" query with all of the columns that I wanted from one or two tables, starting with the parent table (so just one join) - but I would also create the remaining columns that I wanted in my final result and just leave them empty.  Then I would do an "update" query for the columns that I wanted to fill in from other tables.  It was more work to set up in the long run but I reduced the risk of missing records because of inner joins.  Using update queries would just result in those fields being blank if the join was missing.  So then in your scenario, the Parts field would just be blank but I would still have the rest of the data - also would make it a little easier to troubleshoot.
0
 

Author Comment

by:yddadsjd95
ID: 36503746
BusyMama, I didn't need the partTypeID so I got rid of it, which causes values to load in the query, but I am now getting other errors. I will place this question on hold until I can clear up the othe issues.

Thanks!
0
 

Author Closing Comment

by:yddadsjd95
ID: 36510478
BusyMama, thank you for the assistance. As I advised the other say, after taking your advice, I ran into some issues unrelated to this problem. But the crew that assisted on those unrelated issues actually cleared up this one. You were sending me in the right direction though. Thanks again.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question