Renuméroter un champ
Renuméroter un champ dans une table
Directement ou au travers d'une requête qui pourra être triée ou paramétrée.
N'oubliez pas la référence DAO
Sub ReNumeroter(strTable As String, strChamp As String) Dim dbs As DAO.Database Dim rst As DAO.Recordset Dim i As Integer Set dbs = CurrentDb Set rst = dbs.OpenRecordset(strTable, dbOpenDynaset) i = 0 With rst Do While Not .EOF i = i + 1 .Edit .Fields(strChamp) = i .Update .MoveNext Loop End With rst.Close dbs.Close Set rst = Nothing Set dbs = Nothing End Sub
Dernière modification : 08/02/2010 01:26
Catégorie : Les mémos - Tables
Page lue 8294 fois