Private Sub Commande54_Click() '=sauvegarder groupe = deuxieme prcoédure a revoir
Dim rst As Recordset
Dim rs, rs2, rst1, rst2 As Recordset
Dim var As Variant
Dim titi, toto, strList As String
Set rs = CurrentDb.OpenRecordset("select n°compte from comptes where selectionner = -1")
If Me.nom_groupe.Value <> "" Then
Me.liste_compte.Value = strList
strList = ""
Do While Not rs.EOF ' boucle sur le champs n°compte de la table comptes
'insertion dans groupe_details
Set rst = CurrentDb.OpenRecordset("select * from groupe_details")
CurrentDb.Execute "insert into groupe_details(id_groupe,compte) values ('" & id_groupe & "','" & rs!n°compte & "') ", dbFailOnError
'insertion dans groupe : champs multivalué
strList = strList & rs!n°compte & ";"
rs.MoveNext
Loop
Set rs = Nothing
Set rst2 = CurrentDb.OpenRecordset("select * from groupe")
CurrentDb.Execute "insert into groupe(id_groupe,nom_groupe,liste_compte) values ('" & id_groupe & "','" & nom_groupe & "','" & strList & "')", dbFailOnError
Me.Undo
DoCmd.Close
DoCmd.OpenForm "groupe"
Else
titi = MsgBox("Veuillez entrer un nom de groupe", vbExclamation, "WORKFLOW")
End If
Partager