>>>USE \workorde.dbf
>PUBLIC mValue
>STORE workordern TO mValue
>SCAN
>mValue = MAX(workordern, mValue)
>ENDSCAN
>GO BOTTOM
>SET OPTIMIZE ON
>****USE \workorde.dbf
>INSERT INTO workorde FROM ARRAY nrec
>REPLACE workordern WITH mValue+1 NEXT 1
Rebecca:
The code should enter only one record... but you could make it easier to read if you used the good old Scatter... Insert.
SELECT WORKORDE
SCATTER MEMO MEMVAR
m.workordern = mValue + 1
INSERT INTO WORKORDE FROM MEMVAR
Where is the nrec ARRAY initialized?
Wayne
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown