|
-
Apr 21st, 2006, 04:31 AM
#1
Thread Starter
Registered User
How to override a Crystal R. designer module
Hi,
I have this designer module that is a report with a subreport in it and want to know how can I override it in code and at run tim with an sql statement. I want to be able to run a more precise query on a bunch of records than what the designer dsr file has as it returns all the records which is too many for what I want to achieve.
Here's the code I have that runs at runtime:
VB Code:
Set frmDet = New CrystRep2Form
Set FinSumm = New FinSummary
Set AdoRSFinCDSum = New ADODB.Recordset
Set AdoRSFinCPGSum = New ADODB.Recordset
Set AdoRSFinCCGSum = New ADODB.Recordset
Set FinCDSubreport = FinSumm.FinCDSubList.OpenSubreport
Set FinCPGSubreport = FinSumm.FinCPGSubList.OpenSubreport
Set FinCCGSubreport = FinSumm.FinCCGSubList.OpenSubreport
strSql = "SELECT TB.CustomNber, TA.Number_Calling, TA.Date_Time_Called, TA.Call_Destination, TA.Number_Called, " & _
"TA.Call_Duration, TA.Customer_Call_Cost, TA.Carrier_Call_Cost, TA.Calculated_Call_Cost, TA.Customer_Call_Profit, " & _
"TA.Calculated_Call_Profit FROM " & tableStr & " As TA INNER JOIN Customers As TB ON TA.Customer_Index = TB.CustID " & _
"WHERE TA.Customer_Index = 140 AND TA.Date_Time_Called >= #" & FormatDate(Format(frmDate & " 00:00:00", "mm/dd/yyyy hh:mm:ss")) & _
"# AND TA.Date_Time_Called <= #" & FormatDate(Format(toDate & " 23:59:59", "mm/dd/yyyy hh:mm:ss")) & "#"
If AdoRSFinCDSum.State = adStateOpen Then AdoRSFinCDSum.Close
AdoRSFinCDSum.Open strSql, myDbCon, adOpenKeyset, adLockOptimistic
FinCDSubreport.DiscardSavedData
FinCDSubreport.Database.SetDataSource AdoRSFinCDSum
rmDet.CRViewer91.ReportSource = FinSumm
rmDet.CRViewer91.ViewReport
frmDet.Show
This code does not give me the records only for customer 140 and for the dates given here in frmDate and ToDate, but it gives me everything in the Joined tables.
Any help would be appreciated. Thanks.
Last edited by Davos; Apr 21st, 2006 at 04:35 AM.
-
Apr 21st, 2006, 05:56 AM
#2
Re: How to override a Crystal R. designer module
Moved to reporting section.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|