>>>>>>I'm trying to update records that have been printed (the cursor "workorders" contains the work orders that have been printed). The records in the main table need to have a flag set so that they do not print again. The following code works perfectly when I'm debugging, however when running as an EXE nothing is updated, and it looks like the scan is not processing anything.
>>>>>>
>>>>>>
>>>>>> select workorders
>>>>>> go top
>>>>>> scan while !eof()
>>>>>> select WOMaster
>>>>>> seek workorders.WONumber order tag WONumber
>>>>>> if found()
>>>>>> replace WOMaster.WOPrinted with .t.
>>>>>> endif
>>>>>> select workorders
>>>>>> endscan
>>>>>>
>>>>>>
>>>>>>Any observations or suggestions would be appreciated!
>>>>>
>>>>>There is no need of
>>>>>GO TOP
>>>>>an SCAN WHILE NOT EOF()
>>>>>
>>>>>This is enough:
>>>>>
>>>>>select workorders
>>>>>SCAN
>>>>>
>>>>>....
>>>>>ENDSCAN
>>>>>
>>>>>
>>>>>Try this:
>>>>>
>>>>>select workorders
>>>>>SCAN
>>>>> IF SEEK(workorders.WONumber,"WOMaster","WONumber")
>>>>> REPLACE WOPrinted with .t. IN WOMaster
>>>>> ENDIF
>>>>>ENDSCAN
>>>>>
>>>>
>>>>And we can even write it as one update command.
>>>
>>>
>>>I was not sure if VFP6 accepts:
>>>UPDATE ...;
>>>FROM ....;
>>>INNER JOIN ....
>>
>>update it can to be slow a lot,
>>join is not required here
>>
>>UPDATE WOMaster SET WOPrinted = .T. WHERE WONumber IN (SELECT WONumber FROM workorders)
>>
>
>
>Thanks for all the comments! The code I started with did not include some of the obvious things that were not needed as many of you suggested. I guess I should have given the code I started with instead of what I had when I gave up and went to bed. I've never used the Update-SQL command before so I replaced my code with this line and it now works perfectly!! I'm not sure why it wasn't working, but for now on to bigger and better. Once again thanks to all the suggestions!!
I ain't skeert of nuttin eh?
Yikes! What was that?