**************************************** ** build a table for exporting ** a maximum of 9 sub queries can be used with a select ** so multiple selects are required *feature.toolset.tooltype.inspectionset Select *; from dbtwiz!tactualdata ; left Join dbtwiz!tparams ; ON Thisform.zgetfeature(tactualdata.fkey) == Alltrim(tparams.ffeature) And ; Thisform.zgettoolsettype(tactualdata.fkey) == Alltrim(tparams.ftoolset) ; LEFT Join dbtwiz!tinspset ; ON Thisform.zgetisnum(tactualdata.fkey) == tinspset.fisnum ; LEFT Join dbtwiz!ttooltype ; ON Thisform.zgetttnum(tactualdata.fkey) == ttooltype.ftnum ; LEFT Join dbtwiz!tinvlocation ; ON Thisform.zgetnum(tactualdata.fkey,'ttool.fbinnum') == tinvlocation.fbinnum ; LEFT Join dbtwiz!tcurlocation ; ON Thisform.zgetnum(tactualdata.fkey,'ttool.flocnum') == tcurlocation.flocnum ; LEFT Join dbtwiz!tpresstype ; ON Thisform.zgetnum(tactualdata.fkey,'ttool.fpressnum') == tpresstype.fpressnum ; LEFT Join dbtwiz!tproduct ; ON Thisform.zgetnum(tactualdata.fkey,'ttool.fpnum') == tproduct.fpnum ; LEFT Join dbtwiz!tvendor ; ON Thisform.zgetnum(tactualdata.fkey,'ttool.fvnum') == tvendor.fvnum ; LEFT Join dbtwiz!tpo ; ON Thisform.zgetnum(tactualdata.fkey,'ttool.fponum') == tpo.fponum ; WHERE Thisform.zgettoolset(tactualdata.fkey) == Thisform.ztoolset ; Into Cursor cExport Readwrite **any additional subqueries must be added below this line. Select * ; FROM cExport ; LEFT Join dbtwiz!tvendordwg ; ON Thisform.zgetnum(cExport.fkey,'ttool.fvdwgnum') == tvendordwg.fvdwgnum ; LEFT Join dbtwiz!thousedwg ; ON Thisform.zgetnum(cExport.fkey,'ttool.fhdwgnum') == thousedwg.fhdwgnum ; INTO Cursor cExport Readwrite SELECT cExport ALTER TABLE cExport drop COLUMN fkey BROWSE last *COPY TO ALLTRIM(thisform.cntgetfilemy1.cvalue+'Set-'+ALLTRIM(thisform.ztoolset)+'.dbf')