BradCollins
Technical User
With many thanks to the other members here I have found the code (below) that will allow me to take a particular field in my table and concatenate the results into one single line.
My problem now is how can I change this code so that it will only show the records for one user.
My table structure is :
tblAllowedCompanies
fldCompID
fldCompName
tblUsers
fldUserName
fldSecID
Each user may be allocated one or more companies, at the moment the code below returns
1,2,3,4,5,6 - all company numbers listed
I would like to see 1,2,3,6 - only those company numbers allocated to the chosen user.
Thansk again
My problem now is how can I change this code so that it will only show the records for one user.
My table structure is :
tblAllowedCompanies
fldCompID
fldCompName
tblUsers
fldUserName
fldSecID
Each user may be allocated one or more companies, at the moment the code below returns
1,2,3,4,5,6 - all company numbers listed
I would like to see 1,2,3,6 - only those company numbers allocated to the chosen user.
Code:
Private Function UpdateList()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strResult As String
Set db = CurrentDb
Set rs = db.OpenRecordset("tblAllowedCompanies", dbOpenDynaset)
rs.MoveFirst
Do
strResult = strResult & rs("fldCompID") & ", "
rs.MoveNext
Loop Until rs.EOF
UpdateList = Mid$(strResult, 1, Len(strResult) - 2)
rs.Close
db.Close
End Function
Thansk again