I think problem is in the line
'AND sh.shShipWeek < ?Thisform.dstartweek +(7 * 4) '+ ;. Try
lnStartweek = ThisForm.dstartweek
lnEndweek = lnStartweek + (7 * 4)
lcselectsql = 'SELECT sh.shpk, sh.ohpk, oh.ohordno, sh.shshipno, sh.shshipweek '+ ;
'FROM EckeMaster!shipmentheader as sh, eckemaster!orderheader as oh '+ ;
'WHERE oh.ohpk = sh.ohpk '+ ;
'And sh.whpk = 0 ' + ;
'AND sh.shShipWeek < ?lnEndweek '+ ;
'AND sh.shShipweek >= ?lnStartweek '+ ;
'AND sh.shpk in (Select DISTINCT shpk '+ ;
'FROM EckeMaster!ShipmentDetail as SD '+ ;
'JOIN EckeMaster!OrderDetail as OD '+ ;
'ON OD.odpk = SD.odpk '+ ;
'WHERE OD.odqtyCommit > 0) '+ ;
'Order By sh.shshipweek'
BTW, 'sh.whpk = 0' is equivalent to 'EMPTY(sh.whpk)'.
Or sh.whpk = 0
>I've created a select statement to use in spt that no matter how modified refuses to get me a return of anything other the none field with values that don't exist
>
>Here is the select statement:
>lcselectsql = 'SELECT sh.shpk, sh.ohpk, oh.ohordno, sh.shshipno, sh.shshipweek '+ ;
> 'FROM EckeMaster!shipmentheader as sh, eckemaster!orderheader as oh '+ ;
> 'WHERE oh.ohpk = sh.ohpk '+ ;
> 'And (EMPTY(sh.whpk) Or sh.whpk = 0) '+ ;
> 'AND sh.shShipWeek < ?Thisform.dstartweek +(7 * 4) '+ ;
> 'AND sh.shShipweek >= ?ThisForm.dstartweek '+ ;
> 'AND sh.shpk in (Select DISTINCT shpk '+ ;
> 'FROM EckeMaster!ShipmentDetail as SD '+ ;
> 'JOIN EckeMaster!OrderDetail as OD '+ ;
> 'ON OD.odpk = SD.odpk '+ ;
> 'WHERE OD.odqtyCommit > 0) '+ ;
> 'Order By sh.shshipweek'
>
>Whe nI run directly against the vfp backend, it works exactly as expected. I'm wondering if the sub select is not possible through SPT
--sb--