Results 1 to 2 of 2

Thread: How to override a Crystal R. designer module

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jan 2003
    Posts
    218

    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:
    1. Set frmDet = New CrystRep2Form
    2.     Set FinSumm = New FinSummary
    3.     Set AdoRSFinCDSum = New ADODB.Recordset
    4.     Set AdoRSFinCPGSum = New ADODB.Recordset
    5.     Set AdoRSFinCCGSum = New ADODB.Recordset
    6.     Set FinCDSubreport = FinSumm.FinCDSubList.OpenSubreport
    7.     Set FinCPGSubreport = FinSumm.FinCPGSubList.OpenSubreport
    8.     Set FinCCGSubreport = FinSumm.FinCCGSubList.OpenSubreport
    9.  
    10.         strSql = "SELECT TB.CustomNber, TA.Number_Calling, TA.Date_Time_Called, TA.Call_Destination, TA.Number_Called, " & _
    11.             "TA.Call_Duration, TA.Customer_Call_Cost, TA.Carrier_Call_Cost, TA.Calculated_Call_Cost, TA.Customer_Call_Profit, " & _
    12.             "TA.Calculated_Call_Profit FROM " & tableStr & " As TA INNER JOIN Customers As TB ON TA.Customer_Index = TB.CustID " & _
    13.             "WHERE TA.Customer_Index = 140 AND TA.Date_Time_Called >= #" & FormatDate(Format(frmDate & " 00:00:00", "mm/dd/yyyy hh:mm:ss")) & _
    14.             "# AND TA.Date_Time_Called <= #" & FormatDate(Format(toDate & " 23:59:59", "mm/dd/yyyy hh:mm:ss")) & "#"
    15.         If AdoRSFinCDSum.State = adStateOpen Then AdoRSFinCDSum.Close
    16.         AdoRSFinCDSum.Open strSql, myDbCon, adOpenKeyset, adLockOptimistic
    17.         FinCDSubreport.DiscardSavedData
    18.         FinCDSubreport.Database.SetDataSource AdoRSFinCDSum
    19.         rmDet.CRViewer91.ReportSource = FinSumm
    20.         rmDet.CRViewer91.ViewReport
    21.         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.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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
  •  



Click Here to Expand Forum to Full Width