>>>>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 >>>>>>>
>>>> WHERE ( ( ( EMPTY(?ldDateReqd) ; >>>> OR Ordhead.daterequired <= ( ?ldDateReqd ) ); >>>> OR NOT (EMPTY(Invhead.picked) ) ); >>>> AND ( ( ?lnLocation ) = ( 0 ); >>>> OR Ordhead.location = ( ?lnLocation ) ) ); >>>> AND EMPTY(dispatchdate) ; >> >>>>
>*** I want ALL records no matter the location and daterequired >ldDateReqd = {} >lnLocation = 0 >REQUERY(ViewHere) > >*** I want ALL records no matter the location but for specific period (OK not period :o)) >ldDateReqd = DATE()-50 >lnLocation = 0 >REQUERY(ViewHere) > >*** I want ALL records for specific location >ldDateReqd = {} >lnLocation = 1 >REQUERY(ViewHere) > >*** And finally I want ALL records for specific location and specific dates >ldDateReqd = DATE()-50 >lnLocation = 1 >REQUERY(ViewHere) >Ah, I see. Thanks for the explanation. I always build my queries on the fly, so I have not had the need for this!