CREATE CURSOR cÉtap1 (Séquence n(3), DescServ C(50), CléPrimaire I) * Here some code I didn't include. It will put records in the cursor cÉtap1 CREATE CURSOR ; cRapp ( Entete1 c(50), Entete2 c(50), Entete3 c(50), Entete4 c(50),; * And a bunch of other fields. ) SELECT Séquence, DescServ, CléPrimaire ; FROM cÉtap1 ; ORDER BY DescServ ; INTO CURSOR cSuiviServ READWRITE SELECT ... INTO CURSOR cEmp1Temp READWRITE IF _tally = 0 DO FORM ts_messagebox WITH I('Pas de données à imprimer.') ELSE FOR nI = 1 TO 25 INSERT INTO cRapp ; (; Entete1,; Entete2,; Entete3,; Entete4; ); VALUES ; (; cEntete1,; cEntete2,; cEntete3,; cEntete4; ) ENDFOR nTotLigne = 0 SCAN nTotLigne = nTotLigne + 1 * INSERT INTO cRapp ( NomServ1) VALUES ("") SELECT cSuiviServ nI = 0 SCAN ni = nI + 1 cNi = ALLTRIM( STR( ni)) cReplace = "Replace NomServ" + cNi + " with cSuiviServ.DescServ in 'cRapp'" &cReplace ENDSCAN replace Entete1 WITH cEntete1 IN "cRapp" replace Entete2 WITH cEntete2 IN "cRapp" replace Entete3 WITH cEntete3 IN "cRapp" replace Entete4 WITH cEntete4 IN "cRapp" replace date WITH cEmp1Temp.DateRv IN "cRapp" Replace NomProf WITH I("Professeur") + ": " + ALLTRIM( cEmp1Temp.NomProf) IN "cRapp" replace Heur WITH cEmp1Temp.HeurDebu IN "cRapp" replace NomClient WITH cEmp1Temp.NomClient IN "cRapp" replace Tél WITH cEmp1Temp.Téléphone IN "cRapp" nPos = cEmp1Temp.Séquence cReplace = "replace LignServChoisiPos" + ALLTRIM( STR( nPos)) +; " with 'X' in 'cRapp'" &cReplace SKIP IN cRapp SELECT cEmp1Temp ENDSCAN * Here again I didn't copy the code because anyway the insert didn't succeed.I also think that one replace (comma separated pairs of fields and values) would give you better performance.. Ah, also you do not need macros, ie
replace LignServChoisiPos" + ALLTRIM( STR( nPos)) + " with 'X' in 'cRapp' * can be changed to: replace (LignServChoisiPos" + ALLTRIM( STR( nPos))) with 'X' in 'cRapp'(I know I am not helping with the original problem but nitpicking, sorry)