* *** prepare a cursor to supply a memo field CREATE CURSOR curTempOeno (Oeno n(8), Item n(6), TempId c(10)) index on TempId tag TempId set order to TempId CREATE CURSOR curTempMemo (OERef M) APPEND BLANK _TALLY = 0 * *** do the actual querry and collect the data SELE ; COUNT(*) AS ItemCount, ; This._CombineOENumbers(q_CoDet.pn,q_CoDet.opt1,q_CoDet.opt2,q_CoDet.opt3,q_CoDet.opt4,q_CoDet.opt5,q_CoDet.opt6,q_CoDet.opt7,q_CoDet.opt8,q_CoMast.duedate) as OERefTemp, ; curTempMemo.OERef AS OERef, ; q_CoDet.pn, ; q_CoDet.opt1, ; q_CoDet.opt2, ; q_CoDet.opt3, ; q_CoDet.opt4, ; q_CoDet.opt5, ; q_CoDet.opt6, ; q_CoDet.opt7, ; q_CoDet.opt8, ; SUM(q_CoDet.qtyord) AS qtyord, ; iif(IsBlank(q_CoDet.duedate), q_CoMast.duedate, q_CoDet.duedate) ; FROM ; mrp_codet AS q_CoDet inner JOIN mrp_comast AS q_CoMast ON q_CoDet.oeno = q_CoMast.oeno, ; curTempMemo ; WHERE ; &cFilterString ; GROUP BY ; q_CoDet.pn, ; q_CoDet.opt1, ; q_CoDet.opt2, ; q_CoDet.opt3, ; q_CoDet.opt4, ; q_CoDet.opt5, ; q_CoDet.opt6, ; q_CoDet.opt7, ; q_CoDet.opt8, ; q_CoMast.duedate ; INTO CURSOR (OECursor) * *** remember how many result-records we got nRecProccessed = _TALLY * *** in vfp6 we must cheat a bit here * *** in order to put all oeno's and items in a memo field * *** we must 1st put the in a seperate table with an id linking * *** them to the record in the master table * *** then we have to scan it and add the numbers to the memo field * *** in vfp9 we can use the Cast() function to convert a returning * *** character string to a memo string/field * *** all this is needed for reporting and reference reasons sele (OECursor) oToolBox.oLocalSql.MakeCursorReadWrite(OECursor) scan sele curTempOeno seek &OECursor..OERefTemp scan rest while curTempOeno.TempId == &OECursor..OERefTemp repl ; &OECursor..OERef with ; iif(Empty(&OECursor..OERef), "", &OECursor..OERef+"|") + ; trans(curTempOeno.oeno) +","+ ; trans(curTempOeno.item) endscan sele (OECursor) endscan * *** ************************************************ Procedure _CombineOENumbers LPARA ; cPn, ; cOpt1, ; cOpt2, ; cOpt3, ; cOpt4, ; cOpt5, ; cOpt6, ; cOpt7, ; cOpt8, ; dDueDate LOCAL ; OldSelect, ; a_TempOeReference(1,2), ; ReturnedRecords, ; i, ; ReturnValue * *** this method will collect all oeno's and item's for the combined * *** partnumbers (groubBy) in the CollectDataFromOE() Method OldSelect = SELECT() cTempId = SYS(2015) SELE ; q_temp.oeno, ; q_temp.ITEM, ; m.cTempId AS TempId ; FROM ; codet AS q_Temp inner JOIN comast AS q_Temp1 ON q_Temp.oeno = q_Temp1.oeno ; WHERE ; q_temp.pn = cPn .AND. ; q_temp.opt1 = cOpt1 .AND. ; q_temp.opt2 = cOpt2 .AND. ; q_temp.opt3 = cOpt3 .AND. ; q_temp.opt4 = cOpt4 .AND. ; q_temp.opt5 = cOpt5 .AND. ; q_temp.opt6 = cOpt6 .AND. ; q_temp.opt7 = cOpt7 .AND. ; q_temp.opt8 = cOpt8 .AND. ; q_Temp1.duedate = dDueDate ; INTO ; ARRAY a_TempOeReference SELE curTempOeno APPEND FROM ARRAY a_TempOeReference SELECT(m.OldSelect) RETURN(m.cTempId) EndProcThank you all for all your help!