1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Function DissocierNomEtPrenoms()
Dim StrSQL as String, Rst as DAO.Recordset
StrSQL="SELECT AnnNomPren, Nom, Prenoms FROM tblAnnuaire;"
set Rst=CurrentDB.OpenrecordSet(StrSQL)
If Rst.RecordCount=0 Then
msgbox "Aucun enreg dans la table"
Rst.Close
set Rst=Nothing
exit sub
Else
Rst.MoveLast
Rst.MoveFirst
Do Until Rst.EOF
Rst.Edit
Rst![Nom]=Split(Rst![AnnNomPren]," ")(0)
Rst![Prenoms]=Split(Rst![AnnNomPren]," ")(1)
Rst.UpDate
Rst.MoveNext
Loop
Rst.Close
set Rst=Nothing
msgbox "Opération terminée"
End If
End Function |
Partager