Aeric Level: Sage

 Registered: 16-06-2003 Posts: 53
|
Execute more than 1 SQL command
Hello...
I am creating a report using Crystal Reports 8.5 and Visual Basic 6 with Report Designer Component. The program will grabs some data from a few tables like ClientGroup, ClientAcc and some transaction related tables like Sales Invoice, Receipt, Payment and etc to generate a Client Ledger report. I grab all the related data from the ClientAcc with those transaction tables using UNION in SQL and create a VIEW in SQL Server database. Then i SELECT the records from the VIEW where ClientAcc(s) are selected from a specified ClientGroup using loop and insert them to a temporary table and add some info e.g Client IP and Timestamp. Then the report is generated by using Report.Database.AddADOCommand conn, adocmd
This method will created a lot of redundant data in the VIEW and temporary table with the same Client details and thus affect the report performance. Can I execute the ADO more than 1 time so I can get the Client details once only for each Client and then display the transaction details respectively?
What I want is a report with a format like this.
Page 1
REPORT TITLE
TRANSACTION DATE FROM X TO Y
CLIENT A DETAILS FROM CLIENT GROUP 1
TRANSACTION DETAILS
Page 2
REPORT TITLE
TRANSACTION DATE FROM X TO Y
CLIENT B DETAILS FROM CLIENT GROUP 1
TRANSACTION DETAILS
Page 3
REPORT TITLE
TRANSACTION DATE FROM X TO Y
CLIENT B DETAILS FROM CLIENT GROUP 2
TRANSACTION DETAILS
Page 4
REPORT TITLE
TRANSACTION DATE FROM X TO Y
CLIENT D DETAILS FROM CLIENT GROUP 2
TRANSACTION DETAILS
CLIENT DETAILS: Client Name, Address, Tel, Fax
TRANSACTION DETAILS: Trans Date, Invoice No, Description, Debit, Credit
Please Help...
|