>>Local lcmasterid, lnavgrec1, lnavgrec2, lnavgrec3, lnpackno, lntakano, lntotrec, lntrnno >>USEFILE('cuttm') >>USEFILE('cuttct') >>USEFILE('packtc') >>lntakano = 0 >>Select cuttm >>Set Order To takano && if you set the oreder explicitly, leave out the index name in seek / less parameters often faster >>Select packtm >>Set Order To MASTERID >>Select packtc >>Set Order To takano >>Select cuttct >>Set Order To && set later if needed! >> >>Wait Window 'Working... Taka... Please Wait...' At Srows() / 2, Scols() / 2 Nowait >> >>Select cuttct >>Scan For Not Empty(takano) && Created a BINARY index on empty(takano) >> Do Case >> Case Seek(takano, "packtc") && sure of your logic ? record will not be reset in otherwise if 2nd seek fails! ?AND? >> If Seek(packtc.MASTERID, 'packtm') >> Replace ; >> packed With Iif(packtm.packno <> 0, 'Y', ' ') ; >> packno With packtm.packno ; >> recuttno With 0 >> Endif >> Case Seek(takano, "cuttm") or Seek(takano, "cuttm") >> Replace packed With Iif(cuttm.trnno <> 0, 'Y', ' '), packno With 0, recuttno With cuttm.trnno >> Otherwise >> Replace packed With ' ', packno With 0, recuttno With 0 >> Endcase >>Endscan >>Wait Clear >>>>