>Hi Everyone:
> I want to create a table with 32 fields in a tabel. The number of fields in a table could be varry. I am using a For loop to do this,however, it is not working. Can someone please tell me what I am doing wrong?
>
>**Code
>CREATE TABLE salesman ;
> For i = 1 to lnCount && lnCount has the number of fields in a given table.
> ('Field' + Str(i) c(20))
> EndFor
>
>Thanks
>MA
MA,
Build the string first and then use macro substitution to issue it.
lcstring = [CREATE TABLE salesman (]
For ii = 1 to lnCount
lcstring = lcstring + ['Field' ] + transform(i) + [ c(20),]
if ii = lncount then
lcstring = left(lcstring,len(lcstring)-1)
endif
EndFor
lcstring = lcstring + [)]
&lcstring
You may have to tweak this as I did not test it.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao