>SELECT VAL(Customer.code) AS valcode, Invhead.*, Ordhead.location,; > Ordhead.entered, Ordhead.priorityorder, Ordhead.customerpo,; > Ordhead.daterequired, Ordhead.comm1, Ordhead.comm2, Ordhead.comm3,; > Ordhead.terms, Customer.name, Customer.code, Customer.creditlmt,; > Customer.einnumber, Customer.specialdisc, Customer.dollarsuse,; > Ordhead.customerid, Customer.country AS custcountry,; > Prodqty.totordered, Prodqty.totallocated, Prodqty.totshipped, .F. AS ok,; > Rdytoship.rdytoship, Shipped.shipped, Prodqty.specialord,; > ALLTRIM(STR(Ordhead.orderid))+IIF(Ordhead.sbo,"B"," ") AS dispordno,; > Customer.onhold; > FROM ; > frantisi!invhead ; > INNER JOIN frantisi!ordhead ; > ON Invhead.orderid = Ordhead.orderid ; > INNER JOIN frantisi!shipped ; > ON Ordhead.orderid = Shipped.orderid ; > INNER JOIN frantisi!rdytoship ; > ON Invhead.invoiceno = Rdytoship.invoiceno ; > INNER JOIN frantisi!customer ; > ON Customer.customerid = Ordhead.customerid ; > INNER JOIN frantisi!prodqty ; > ON Ordhead.orderid = Prodqty.orderid; > WHERE ( ( ( EMPTY(?ldDateReqd) ; > OR Ordhead.daterequired <= ( ?ldDateReqd ) ); > OR NOT (EMPTY(Invhead.picked) ) ); > AND ( ( ?lnLocation ) = ( 0 ); > OR Ordhead.location = ( ?lnLocation ) ) ); > AND EMPTY(dispatchdate) ; > ORDER BY 1, Ordhead.priorityorder DESC, Invhead.invoiceno ; >into cursor dispatch >>TIA,