>cSplit,nItem_No,cProd,cBatch > 1 A > 2 A B12 ----> Record Added > 3 B > 4 C > 5 D>
> SELECT myCursor > INDEX ON cProd+STR(cno,2) TO cSort > SET ORDER TO cSort > > SELECT myCursor > no_rec = 0 > Go Top > Do While !EOF() > no_rec = no_rec + 1 > Repl cno WITH no_rec > Select MyCursor > Skip > Endd > > Click Method in split Button > > SELECT myCursor > GO Thisform.recordno > IF cSplit = 'M' > Replace cno WITH cno+1 > ln_no = cNO > lc_Prod = cProd > lc_split = cSplit > > SELECT myCursor > Append Blank > Replace cNo WITH ln_no+1 > REPLACE cprod WITH lc_prod > Replace cBatch with space(5) > replace cSplit WITH 'C' > Thisform.ShowGrid() > Endif > Thisform.Sort_no() > Thisform.Grid1.Refresh()Ok, try this method instead:
local lnCurNo, lnCurRecNo lnCurNo = myCursor.cNo && This record would be duplicated lnCurRecno = recno('myCursor') replace cNo with cNo+2 for cNo > m.lnCurNo in myCursor && increase all numbers by 2 since a new record would be inserted select myCursor goto m.lnCurRecno && Go back on the current record scatter memvar memo && create memvars with the same values cNo=cNo+1 && Number should be increased by 1 for the new record insert into myCursor from memvar thisform.grid1.refresh()This is of the top of my head and not tested, but should give you the idea.