I\'m trying to aggregate some instructor data (to easily show which courses an instructor taught in a semester), and up until now I\'ve just accepted having multiple rows fo
This is easy using Allen Browne's ConcatRelated() function. Copy the function from that web page and paste it into an Access standard code module.
Then this query will return what you asked for.
SELECT
i.N_ID,
i.F_Name,
i.L_Name,
ConcatRelated(
"Course_ID",
"tbl_Courses",
"N_ID = '" & [N_ID] & "'"
) AS Course_IDs
FROM tbl_Instructors AS i;
Consider changing the data type of N_ID
from text to numeric in both tables. If you do that, you don't need the single quotes in the third argument to that ConcatRelated()
expression.
"N_ID = " & [N_ID]
And whenever you need N_ID
displayed with leading zeros, use a Format()
expression.
Format(N_ID, "000")