Donald,
Two changes, marked below. You can do this with a named expression (using parenthesis) rather than macro expansion.
HTH,
steve
>
>I am attempting to use a loop with a REPLACE inside the loop. The field names and the values to be replaced change with every iteration. I am using macro substitution, the values are correct asigned, but REPLACE crashes every time with an unrecognized command or syntax error, depending on the circumstances.
>
>lcfieldname = "field" + alltrim(str(lnCnt))
>
>lcvalue = "myvalue"
>SELECT mytable
>REPLACE (lcfieldname) WITH lcvalue
>lnCnt = lnCnt + 1
Steve Gibson