I am using Visual Basic 6, Crystal Reports 10 and SQL Server 2000. In crystal reports, I used Add Command and entered an SQL Query for the report. This query retrieves all transactions of a year.
In visual basic, I created a selection form, in which user enters selection criteria for Post Entry Date, Transaction Number and Journal Code. I initially used Report1.RecordSelectionFormula, but it filters the record on client side and retrieving all year transactions from server takes a lot of time.
I then decided to use Report1.SQLQueryString. To test it, I entered sample transaction range, post entry date range and journal code range in SQL Query and run this query in SQL Server 2000. Then I copied that query to SQLQueryString:
Report1.SQLQueryString = QueryTestedOnSQLServer
But when I watched the contents of Report1.SQLQueryString in Immediate Window, after executing the above statement, it showed the same SQL Query that was originally written in Crystal Reports Add Command.
In visual basic, I created a selection form, in which user enters selection criteria for Post Entry Date, Transaction Number and Journal Code. I initially used Report1.RecordSelectionFormula, but it filters the record on client side and retrieving all year transactions from server takes a lot of time.
I then decided to use Report1.SQLQueryString. To test it, I entered sample transaction range, post entry date range and journal code range in SQL Query and run this query in SQL Server 2000. Then I copied that query to SQLQueryString:
Report1.SQLQueryString = QueryTestedOnSQLServer
But when I watched the contents of Report1.SQLQueryString in Immediate Window, after executing the above statement, it showed the same SQL Query that was originally written in Crystal Reports Add Command.