% SET EXCLUSIVE off theitem=ALLTRIM(UPPER(TRANSFORM(NVL(orequest.querystring('theitem'),'')))) thedesc='Scan item to get details' thesale=0 theitemid=theitem IF NOT EMPTY(theitem) tsql=[SELECT itemid, name, sale, pcost, stock FROM (']+dbclocation+[itemmast') WHERE ALLTRIM(UPPER(itemid))==']+ALLTRIM(theitem)+[' INTO CURSOR xxx] &tsql IF RECCOUNT()=0 tsql=[SELECT itemid, name, sale, pcost, stock FROM (']+dbclocation+[itemmast') WHERE itemid in (SELECT itemid FROM (']+dbclocation+[asctable') WHERE ] tsql=tsql+[ ALLTRIM(UPPER(bar_code))==']+ALLTRIM(theitem)+[') INTO CURSOR xxx] &tsql endif IF RECCOUNT()<>0 thedesc=ALLTRIM(name) thesale=sale theitemid=itemid thepurchase=pcost thestock=stock ELSE thedesc=[ITEM NOT FOUND IN DATABASE!] THESALE=0.00 thepurchase=pcost thestock=stock endif if round(thesale,0)=thesale thesale=round(thesale,0) ENDIF if round(thepurchase,0)=thepurchase thepurchase=round(thepurchase,0) ENDIF if round(thestock,0)=thestock thestock=round(thestock,0) ENDIF ENDIF **** use in select('itemmast') CLOSE tables CLOSE DATABASES CLOSE TABLES %>