1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Public Function LstCom(MA As Integer) As String
Dim res As DAO.Recordset
Dim SQL As String
'Selectionne les participant du projet
SQL = "SELECT Co_nom FROM TL_Commune INNER JOIN Ti_Com_MA ON TL_Commune.[Co_Id] = Ti_Com_MA.[INSEE] WHERE IdentifiantMA=" & MA
Set res = CurrentDb.OpenRecordset(SQL)
'Concatene les différents enregistrement
While Not res.EOF
LstCom = LstCom & res.Fields(0).Value & ", "
res.MoveNext
Wend
'Enleve le dernier virgule - espace
LstCom = Left(LstCom, Len(LstCom) - 2)
'libere la mémoire
Set res = Nothing
End Function |