Apologies if this is not the right board - wasn't sure if this should go here or in the Queries section!
OK, I have two table, one has a list of Users and the other has a list of Divisions they could belong to. So, something like:
Table 1:
UserID
Username
etc.
Table 2:
UserID
DivID
A User can exist in more than one Division. I need to be able to produce a list showing the DivIDs for each User as a csv string. So, if my data looked like:
Table 1:
User ID
1
2
3
4
Table 2:
User ID DivID
1 1
1 2
2 1
2 2
2 3
I need to get:
User ID DivID's
1 1, 2
2 1, 2, 3
Any ideas?
I've thought about creating a Recordset and looping through each record creating the csv and checking the UserID of the current record to the next record to see if it is the same (continue building the csv) or different (start a new csv) but I am wondering if there is a better way.
Thanks.
OK, I have two table, one has a list of Users and the other has a list of Divisions they could belong to. So, something like:
Table 1:
UserID
Username
etc.
Table 2:
UserID
DivID
A User can exist in more than one Division. I need to be able to produce a list showing the DivIDs for each User as a csv string. So, if my data looked like:
Table 1:
User ID
1
2
3
4
Table 2:
User ID DivID
1 1
1 2
2 1
2 2
2 3
I need to get:
User ID DivID's
1 1, 2
2 1, 2, 3
Any ideas?
I've thought about creating a Recordset and looping through each record creating the csv and checking the UserID of the current record to the next record to see if it is the same (continue building the csv) or different (start a new csv) but I am wondering if there is a better way.
Thanks.