Simplify Multiple Joins for Sub (1 Viewer)

Zydeceltico

Registered User.
Local time
Yesterday, 22:20
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
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 12:20
Joined
Jan 20, 2009
Messages
12,851
You could alias the tablenames and format the code to be more readable.
 

plog

Banishment Pending
Local time
Yesterday, 21:20
Joined
May 11, 2011
Messages
11,638
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

Top Bottom