Limit a company appearance to once only

Bobp3114

Member
Local time
Tomorrow, 01:09
Joined
Nov 11, 2020
Messages
69
I have two tables joined by StationID. In a query that shows which companies (stations) have a link (RPCustomerPoNumber) to field in the other table, but I only want to see that company name once. The query is unbound.
1647570335832.png

SELECT DISTINCT tblRepReport.StationID, tblStationData.[Station Name], tblRepReport.RPCustomerPONumber
FROM tblStationData LEFT JOIN tblRepReport ON tblStationData.StationID = tblRepReport.StationID
WHERE (((tblRepReport.RPCustomerPONumber) Is Not Null))
ORDER BY tblStationData.[Station Name];

Thanks for any help as I thought SELECT DESTINCT would do this. I have tried all join types.
Bob
 
that is the Normal records on using Query.
if you want to show only one StationID, Station Name, use a Parent Form->Child subform.

also you can only do that on a Report.
 

Attachments

Last edited:
Code:
SELECT DISTINCT tblRepReport.StationID, tblStationData.[Station Name], tblRepReport.RPCustomerPONumber

That is giving you every unique combination of StationID, Name and PO. If you want just one Name, then what values do you want to show for the other 2 fields? You have multiple of those values to choose from--how are you deciding which to show with that one name?
 
Do you actually need to see the values in the RPCustomerPONumber field or just check that values exist?
Unticking the RPCustomerPONumber field in your query will then show each stationID & name (which has a PONumber) once only
 
Last edited:
There is no need for a left join either, just change the link to an inner join and remove the RPCustomerPONumber field from the query grid at the bottom
 
Do you actually need to see the values in the RPCustomerPONumber field or just check that values exist?
Unticking the RPCustomerPONumber field in your query will then show each stationID & name (which has a PONumber) once only
Thanks all..i used isladogs idea with success...I will learn from the other info .

isladogs idea​

 

Users who are viewing this thread

Back
Top Bottom