Bonjour,
Je voudrais renommer des champs d'une table ; J'utilise le code suivant :
et ensuite le code suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 Public sub RenommerChamp(PTable as string,POld as string ,PNew as String) On error goto err: Dim VTable as DAO.Tabledef Dim VField as DAO.Field set VTable=currentDb.TableDefs(PTable) set VField=VTable.Fields(POld) VField.Name=PNew set VField=Nothing set VTable=Nothing exit sub err: msgbox "L'action renommer le champ a échoué" End Sub
Il me retourne le message d'erreur : L'action renommer le champ a échoué
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 Dim FirstDay as variant ' Récupère la première date listing docmd.openform "listing date (invisible)" FirstDay = forms![[listing date (invisible)]![date] docmd.close acform,"listing date (invisible)" RenommerChamp "listing papier table","1","FirstDay" ....
La table "listing papier table" contient des champs nommés de 1 à 31 et j'aimerais renommer ces champs par des dates !
Merci par avance de vos aides !
Partager