Im trying to add this Table/Field; Customer.Customer and have it linked to SO_Header.Customer to the existing functional below Query.
sql = sql & "Material.Location_ID, " _
& "Round(Q1.OHQ,0) AS OHQ, " _
& "SO_Detail.Note_Text, " _
& "SO_Header.Note_Text AS sSONotes " _
& "FROM SO_Header INNER JOIN ((SO_Detail LEFT JOIN Material ON SO_Detail.Material = Material.Material) LEFT JOIN " _
& "(SELECT Material_Location.Material, Sum(Material_Location.On_Hand_Qty) AS OHQ " _
& "FROM Material_Location " _
& "GROUP BY Material_Location.Material) AS Q1 " _
& "ON SO_Detail.Material = Q1.Material) ON SO_Header.Sales_Order = SO_Detail.Sales_Order SO_Header.Customer = Customer.Customer "
sql = sql & "Material.Location_ID, " _
& "Round(Q1.OHQ,0) AS OHQ, " _
& "SO_Detail.Note_Text, " _
& "SO_Header.Note_Text AS sSONotes " _
& "FROM SO_Header INNER JOIN ((SO_Detail LEFT JOIN Material ON SO_Detail.Material = Material.Material) LEFT JOIN " _
& "(SELECT Material_Location.Material, Sum(Material_Location.On_Hand_Qty) AS OHQ " _
& "FROM Material_Location " _
& "GROUP BY Material_Location.Material) AS Q1 " _
& "ON SO_Detail.Material = Q1.Material) ON SO_Header.Sales_Order = SO_Detail.Sales_Order SO_Header.Customer = Customer.Customer "