I have the following problem concerning my Access Database:
I have 3 tables which are tblComponents, tblErrors, and linkComponentsErrors. This is a many to many relations
You can use my DJoin function for this:
SELECT
tblComponents.compname,
DJoin(
"errname",
"SELECT compID, errname
FROM linkComponentsErrors
INNER JOIN tblErrors ON linkComponentsErrors.errID = tblErrors.errID",
"compID = " & [tblComponents].[compID] & "",
", ") AS errnames
FROM
tblComponents
INNER JOIN
linkComponentsErrors ON tblComponents.compID = linkComponentsErrors.compID
GROUP BY
tblComponents.compname,
DJoin(
"errname",
"SELECT compID, errname
FROM linkComponentsErrors
INNER JOIN tblErrors ON linkComponentsErrors.errID = tblErrors.errID",
"compID = " & [tblComponents].[compID] & "",
", "),
tblComponents.compID
ORDER BY
tblComponents.compID;
Output: