Search code examples
crystal-reports

Crystal reports out of range value vendor error 242


I am writing a report in Crystal 2020 that has previously worked in Crystal 2008 based on data pulled from an SQL view which shows the sum of qty based on a date range between today and 5 days ago. The report populates fine until I put the where clause in the SQL view. The SQL is

SELECT Company, SourceWarehouse, TargetWarehouse, StockCode, SUM(GtrQuantity) AS TrfQty, CONVERT(varchar, CAST(CAST(GETDATE() AS DATE) AS DATETIME), 23) AS LookOutDate
FROM     dbo.vwGtrSuggestionsQtyByDate
WHERE  (TransactionDate BETWEEN DATEADD(day, - 5, GETDATE()) AND GETDATE())
GROUP BY Company, SourceWarehouse, TargetWarehouse, StockCode

The SQL view runs without any problem so I am stuck as to how I can get the results into my report.


Solution

  • Perhaps your TransactionDate is a DateTime rather than Date. So you need the rest of the WHERE clause to use DateTime rather than Date expressions.