Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

need report query without duplicate records

Posted on 2011-02-24
8
Medium Priority
?
251 Views
Last Modified: 2012-05-11
I have table TubeData with fields SerialNumber, DateReceived, Customer, Type, SalesOrder, PurchaseOrder, and Part Number.
Also have table CurrentLocation fields SerialNumber,DateMoved, Area, and PartNumber.

When the report is opened the user is prompted for SerialNumber and PartNumber.

The report opens and displays the field data from TubeData at the top of the page.  Then should list the records from the CurrentLocation table matching the SerialNumber and PartNumber.

In the attached db.  Open the Switchboard.  Under Reports select Move History for Tube by Serial Number.  
Enter the serial number 41049.  Part number PS463

There are 2 records in TubeData for SN 41049.  One received 8/9/10 and one received 12/17/10.
There are 12 records in CurrentLocation for SN 41049.

The report shows 24 records.  Duplicating each record in CurrentLocation for each record in TubeData.

I added a 3rd record to TubeData for 41049 and the report then shows 36 records.  Duplicating each record 3 times.

Here is the query used for the report:
SELECT TubeData.SerialNumber, TubeData.VmiPartNumber, TubeData.Date_Received, TubeData.Customer, TubeData.TubeType, TubeData.SalesOrder, [Current Location].SerialNumber, [Current Location].Area, [Current Location].[Date Moved], [Current Location].VmiPartNumber, TubeData.CustomerPO
FROM TubeData INNER JOIN [Current Location] ON TubeData.SerialNumber=[Current Location].SerialNumber
WHERE ((([Current Location].SerialNumber)=[Serial Number:]) AND ([Current Location].VmiPartNumber=[Part Number:] Or isnull([Current Location].VmiPartNumber)));

How can I eliminate the duplicate records in the report?
Thanks,
Brooks
EE-TTA.mdb
0
Comment
Question by:gbnorton
[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
8 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 34971833
I'm not clear what you are expecting the result to be.

The query is working correctly, based on your description.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34972058
try adding a join in  [VmiPartNumber] , see what it give

FROM TubeData INNER JOIN [Current Location] ON (TubeData.VmiPartNumber = [Current Location].VmiPartNumber) AND (TubeData.SerialNumber = [Current Location].SerialNumber)
0
 
LVL 44

Expert Comment

by:GRayL
ID: 34972934
In Tube Data you have several instances of tubes with the same Serial Number but a different ID.  Then in Current Location you have in the example you gave 12 different dates on which a serial numbered tube was moved. It is normal behavior for the set of locations to be duplicated for every additional record for a given serial number in Tube Data.  Why do you have cases of two or more records for the same Serial Number.  I understand why you can have several parts with the same part number, but Serial Number?  

BTW, after opening the mdb using the Shift Key, on opening the Switchboard form (the only form) and following your instructions, nothing happens there are no controls on the form in which to enter a Serial Number and a Part Number.  Your instruction did not say which report to open.
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

Author Comment

by:gbnorton
ID: 34983447
peter57r:
There are 12 records in the CurrentLocation table with SerialNumber 41049 and VMIPartNumber PS463.  That is all I want to show up is those 12.  Currently 24 show up.

capricorn1:
I added the join and the result is the same.

GRayL:
The table holds records from 3 customers.  Sometimes they use the same serial numbers.  In this case they would have different part numbers.  The other case is for one customer a tube is returned for repair.  When it comes back it is added to the system again.

I uploaded the db again.  

Thanks,
Brooks
EE-TTA.mdb
0
 
LVL 44

Accepted Solution

by:
GRayL earned 2000 total points
ID: 34988727
The way you have it written, you will have one complete set of TubeData/location records for each idential Serial Number in TubeData.  The only thing that discriminates between identical serial numbers is Date_Received.  Therefore you need to include the date as an additional parameter.  Add it to your WHERE clause

WHERE TubeData.DateReceived = [EnterDate:] AND <Your WHERE clause as you have it now>
0
 
LVL 44

Expert Comment

by:GRayL
ID: 34988753
This works as Serial Number Query which the the query behind the Serial Number Move History Report

SELECT TubeData.SerialNumber, TubeData.VmiPartNumber, TubeData.Date_Received, TubeData.Customer, TubeData.TubeType, TubeData.SalesOrder, [Current Location].SerialNumber, [Current Location].Area, [Current Location].[Date Moved], [Current Location].VmiPartNumber, TubeData.CustomerPO
FROM TubeData INNER JOIN [Current Location] ON (TubeData.VmiPartNumber = [Current Location].VmiPartNumber) AND (TubeData.SerialNumber = [Current Location].SerialNumber)
WHERE TubeData.Date_Received = [EnterDate:] AND ((([Current Location].SerialNumber)=[Serial Number:]) AND (([Current Location].VmiPartNumber)=[Part Number:])) OR ((([Current Location].SerialNumber)=[Serial Number:]) AND ((IsNull([Current Location].[VmiPartNumber]))<>False));
0
 

Author Closing Comment

by:gbnorton
ID: 34998481
That works thank you.
0
 
LVL 44

Expert Comment

by:GRayL
ID: 35003274
Thanks, glad to help.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
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…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

719 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