Bonjour à tous,
 
J'ai un formulaire contenant des sections différentes où j'ajoute des clients, des articles, etc....
 
tout ce passe bien sauf pour la numérotation des contrôles :
 
Au premier ajout cela donne :
<xml:Enot:Name>0001
<xml:Enot:Street>0001
<xml:Enot:City>0001
 
Au deuxième ajout
 
<xml:Enot:Name>0001  le premier ajout devient   <xml:Enot:Name>0002
<xml:Enot:Street>0001  le premier ajout devient   <xml:Enot:Street>0002
<xml:Enot:City>0001  le premier ajout devient   <xml:Enot:City>0002
<xml:Enot:Name>0002
<xml:Enot:Street>0002
<xml:Enot:City>0002
 
Ce qui fait que je me retrouve avec 6 articles en 0002
 
<xml:Enot:Name>0002
<xml:Enot:Street>0002
<xml:Enot:City>0002
<xml:Enot:Name>0002
<xml:Enot:Street>0002
<xml:Enot:City>0002
 
Comment faire pour que chaque ajout garde sa numérotation soit le 0001, 002, 0003, etc... ?
Comme ceci :
<xml:Enot:Name>0001
<xml:Enot:Street>0001
<xml:Enot:City>0001
<xml:Enot:Name>0002
<xml:Enot:Street>0002
<xml:Enot:City>0002
<xml:Enot:Name>0003
<xml:Enot:Street>0003
<xml:Enot:City>0003
<xml:Enot:Name>0004
<xml:Enot:Street>0004
<xml:Enot:City>0004             
 
 et ne deviennent pas ça :
<xml:Enot:Name>0004
<xml:Enot:Street>0004
<xml:Enot:City>0004   
<xml:Enot:Name>0004
<xml:Enot:Street>0004
<xml:Enot:City>0004   
<xml:Enot:Name>0004
<xml:Enot:Street>0004
<xml:Enot:City>0004   
<xml:Enot:Name>0004
<xml:Enot:Street>0004
<xml:Enot:City>0004   
 
voici la macro :
 

 '** Renommer les champs des formulaires ************************************
 oForm = thiscomponent.drawpage.Forms.GetByName("Standard") 
 TabNomChamps=oForm.getElementNames
 for i = 0 to ubound(TabNomChamps)
  NomChamp=TabNomChamps(i)
  oChamp=oForm.GetByName(NomChamp)
  if oChamp.Tag<>"" then
   if  oChamp.name<>oChamp.Tag then oChamp.name=oChamp.Tag & " " & NumArticle
  end if
 next
 '***************************************************************************
 
Merci pour les renseignements
Françoise
Binettes de Halloween gratuites pour vos courriels ! Cliquez ici !

Répondre à