Hi Mark,
>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.
>
If you only want the Items that are newly added try something like this:
SELECT * FROM ArInvt;
WHERE Whse = "000;
AND ItemNbr NOT IN (SELECT ItemNbr FROM ArInvt WHERE Whse = "099");
INTO TABLE TempCopy1.Dbf
HTH,
Bill Armbrecht
VFP MCP