lnRecNo = GetNextModified(0,"gridSource") do while m.lnRecno # 0 * if m.lnRecno < 0 && Added record * AddRecord() * else && Edited record * UpdateRecord() * endif UpdateRecord() && Handling both insert and update lnRecNo = GetNextModified(m.lnRecNo,"gridSource") enddoUpdateRecord might look like this:
Procedure UpdateRecord AddUpdate('GridSource','Style','Costed') AddUpdate('GridSource','Style','Cut') AddUpdate('GridSource','Style','Made') endproc Procedure AddUpdate(tcSource,tcStyle,tcActivity) local lnSelect local Style,Activity,ActualDate Style = eval(m.tcSource+'.'+m.tcStyle) Activity = upper(m.tcActivity) ActualDate = eval(m.tcSource+'.'+m.tcActivity) if isnull(m.ActualDate) return endif lnSelect = select() select myBaseTable locate for Style = m.Style and upper(Activity) = m.Activity if eof() insert into myBaseTable from memvar else gather fields ActualDate memvar endif select (m.lnSelect) endprocYou might cut the time it needs instead having UpdateCode() in afterrowcolchange with checking if it was a Row Change.