Hi Ed,
Here is my complete code. Please advice. Thanks, Sam
StartDate = ctod(THISFORM.txtStartDate.Value)
EndDate = ctod(THISFORM.txtEndDate.Value)
Vendor = THISFORM.txtVendorID.Value
Tolerance = val(THISFORM.txtTolerance.Value)
ReptSum = THISFORM.optReportType.optSummary.Value = 1
if EMPTY(THISFORM.txtTolerance.Value)
MessageBox("Please enter the number for days Tolerance!", 64)
else
OPEN DATABASE maxdata
SELECT 0
USE OrderMaster
INDEX ON ORDNUM_10 TAG ordnum_10
if EMPTY(Vendor)
ReptSum = .T.
SELECT * FROM PoEntry ;
WHERE daterecv BETWEEN StartDate AND EndDate ;
ORDER BY vendorname, daterecv ;
INTO CURSOR PoOrders
else
SELECT * FROM PoEntry ;
WHERE daterecv BETWEEN StartDate AND EndDate AND VendorID = '&Vendor' ;
ORDER BY daterecv ;
INTO CURSOR PoOrders
endif
CREATE CURSOR VndrPerf(VendorID C(5), VenName C(25), NumReceipts I, QtyRecv N(10), ;
QtyRej N(6), PerRej B(2), OnTime B(2))
SELECT vendorID, ;
vendorname AS VenName, ;
cnt(*) AS NumReceipts, ;
SUM(qtyrecv) AS QtyRecv, ;
SUM(qtyrej) AS QtyRej, ;
ROUND(QtyRej/QtyRecv*100,2) as PerRej ;
FROM PoEntry GROUP BY 1 ;
WHERE daterecv BETWEEN StartDate AND EndDate ;
INTO CURSOR VndrPerf
SELECT VndrPerf
if reccount() = 0
MessageBox("No Records to Display!",64)
else
VpStartDate = StartDate
VpEndDate = EndDate
VpTolerance = Tolerance
REPORT FORM VendorPerf PREVIEW
endif
endif