>I have an item/whse file that may contain 5000 item/warehouse records. I want to copy all items from warehouse "000" to warehouse "099". This is easy enough using the following code:
>
>Use arivt
>select * from arinvt where whse = "000" into table tempcopy1.dbf
>use tempcopy1
>replace whse with "099" all
>close all
>use arinvt
>append from tempcopy1
>
>this works great...however...if you run it twice it duplicates all the records in the file...how can I avoid duplications?
>
>I have several indexes...item/whse that are set to unique and/or primary...but this does not solve the problem.
>
>any ideas?
It's easy: don't run this code twice :)
Also you can check if records you are trying to add already exist in arinvt
by running following select
SELECT * FROM arinvt, temcopy1 ;
WHERE arinvt.whse = temcopy1.whse ;
AND arinvt.item = temcopy1.item ;
TO SCRREN NOCONSOLE
IF _TALLY > 0 than you've added records already
--sb--