Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have added a COMMAND to a crystal report and it fails on the DATE() 1

Status
Not open for further replies.

rwn

Technical User
Dec 14, 2002
420
US
within this command is this:
SELECT SO_Detail.Material, SO_Detail.SO_Line, SO_Detail.Deferred_Qty, SO_Detail.Backorder_Qty, SO_Detail.Shipped_Qty, Packlist_Detail.Quantity, Delivery.Shipped_Date, SO_Header.Customer_PO
FROM ((SO_Detail INNER JOIN Packlist_Detail ON SO_Detail.SO_Detail = Packlist_Detail.SO_Detail) INNER JOIN Delivery ON Packlist_Detail.SO_Detail = Delivery.SO_Detail) INNER JOIN SO_Header ON SO_Detail.Sales_Order = SO_Header.Sales_Order
WHERE (((SO_Detail.Status) In ('backorder','shipped')) AND ((Delivery.Shipped_Date) Between Date()-13 And Date()));

The overall select statement works except when I add in the date() range.
 
First off, what is your data source. I do not know what database sources use a Date() (I am assuming it is supposed to return the current date).
 
it is an odbc connection to a SQL Database.
 
replace date() with getdate()

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
I replaced as shown below: (it STILL FAILS with this message: Failed to retrieve data from the database. Details: 42000:[microsoft][ODBC SQL Server Driver)[SQL Server[Incorrect Syntax near '].[Database Vendor Code:102]

SELECT SO_Detail.Material, SO_Detail.SO_Line, SO_Detail.Deferred_Qty, SO_Detail.Backorder_Qty, SO_Detail.Shipped_Qty, Packlist_Detail.Quantity, Delivery.Shipped_Date, SO_Header.Customer_PO
FROM ((SO_Detail INNER JOIN Packlist_Detail ON SO_Detail.SO_Detail = Packlist_Detail.SO_Detail) INNER JOIN Delivery ON Packlist_Detail.SO_Detail = Delivery.SO_Detail) INNER JOIN SO_Header ON SO_Detail.Sales_Order = SO_Header.Sales_Order
WHERE (((SO_Detail.Status) In ('backorder','shipped')))
AND ((Delivery.Shipped_Date) Between getdate()-13 And getdate()));



 
found the issue, one to many ).

SELECT SO_Detail.Material, SO_Detail.SO_Line, SO_Detail.Deferred_Qty, SO_Detail.Backorder_Qty, SO_Detail.Shipped_Qty, Packlist_Detail.Quantity, Delivery.Shipped_Date, SO_Header.Customer_PO
FROM ((SO_Detail INNER JOIN Packlist_Detail ON SO_Detail.SO_Detail = Packlist_Detail.SO_Detail) INNER JOIN Delivery ON Packlist_Detail.SO_Detail = Delivery.SO_Detail) INNER JOIN SO_Header ON SO_Detail.Sales_Order = SO_Header.Sales_Order
WHERE (((SO_Detail.Status) In ('backorder','shipped')))
AND ((Delivery.Shipped_Date) Between getdate()-13 And getdate());
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top