local lcInvoice_ID, lnCurrentSeason lnInvoice_ID = 31984 && replace this with a valid invoice number && and the correct datatype, of course lnCurrentSeason = 5 activate screen set deleted on Select * from InvoiceDetail Where Invoice_ID = lnInvoice_ID ; into cursor InvLinesCursor ? "Records selected: ",_tally select invLinesCursor scan && we are scanning invLinesCursor, not invoiceDetail table if indexseek (InvLinesCursor.Product_ID, .t., 'product', 'product_id') * product found ? "updating product: ",invLinesCursor.Product_ID select product Replace UseSeason with lnCurrentSeason else * product not found...error processing here * referential integrity is supposed to prevent this ? "Error, product not found: ",invLinesCursor.Product_ID endif endscanAlso (this is a sidebar), whenever you run your .exe you should probably issue a CLOSE DATA ALL command inside of VFP first, to make sure there aren't any multiuser issues.