Simplify Multiple Joins for Sub

Zydeceltico

Registered User.
Local time
Today, 11:09
Joined
Dec 5, 2017
Messages
843
Is there a way to simplify this to use in VBA sub?

SELECT tblInspectionEvent.InspectionEvent_PK, tblParts.PartType
FROM tblParts INNER JOIN ((tblFinalProducts INNER JOIN (tblJobs INNER JOIN tblInspectionEvent ON tblJobs.Job_ID = tblInspectionEvent.Job_FK) ON tblFinalProducts.FinalProduct_ID = tblJobs.FinalProduct_FK) INNER JOIN tblAssemblyComponents ON tblFinalProducts.FinalProduct_ID = tblAssemblyComponents.FinalProduct_FK) ON tblParts.Part_ID = tblAssemblyComponents.Part_FK;


Thanks!

Tim
 
You could alias the tablenames and format the code to be more readable.
 
As long as the fields in the query don't have similarly named counterparts in the other tables in the query you can omit the table portion when referencing fields:

SELECT InspectionEvent_PK, PartType


That goes for all clauses, not just SELECT
 

Users who are viewing this thread

Back
Top Bottom