>>>Naomi
>>>
>>>The code is just as below
>>>Do you think it's able to append from tables of
>>>an old folder to a new folder, even if the new folder has
>>>more tables than the older one ?
>>>
>>>lnOldTables = adir(laOldTables, MyOldPath + "*.dbf")
>>>lnNewTables = adir(laNewTables, MyNewPath + "*.dbf")
>>>
>>>for lnI = 1 to lnNewTables
>>> lnRow = ascan(laOldTables, laNewTables[m.lnI,1],1,-1,1,15)
>>> if lnRow > 0
>>> wait window timeout 2 "Importing from file " + laOldTables[m.lni,1]
>>> use (laNewTables[m.lnI,1]) exclusive in 0 alias NewData
>>> zap
>>> append from (myOldPath + laOldTables[m.lnRow,1])
>>> use in NewData
>>> endif
>>>NEXT
>>
>>I don't see a bug here, so I think it should work.
>
>Am I missing something here????
>
>use (laNewTables[m.lnI,1]) exclusive in 0 alias NewData
>zap
>etc
>
>NewData is never SELECTed so unless there is no file open in the current workarea, the wrong file will be zapped and appended to.
Right, missed that. I think I was pointing on this ommission in one of my prior messages.
But using try/catch approach eliminates the need to check the array of old tables.
If it's not broken, fix it until it is.
My Blog