Results 1 to 5 of 5

Thread: [RESOLVED] parameterized report

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    12

    Resolved [RESOLVED] parameterized report

    hi , i am using CR9 with VB6 . i have a report designed using CR9 in vb6 . i am using parameter [ ratetype ] to select records from the ITEM table . my problem is when i run the report for the 1st time [ with parameter as 'A' ] its ok . but if i have to view the same report with a different parameter say 'B' it does not ask for the parameter , instead it shows the report directly using the parameter i used the last time . if i stop the app and run it again it now shows the report properly.

    please help

    thanks and regards
    Attached Images Attached Images   

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: parameterized report

    In Crystal, if all Parameter fields have a value, the dialog box is not displayed.

    I don't know which code you are using to view the report but on the second attempt try clearing the Parameter fields beforehand. I hope you are familiar with the CRAXDRT objects

    Code:
    Dim rpt as CRAXDRT.Report
    '...code to open report object
    
    Dim prm as CRAXDRT.ParameterFieldDefinition
    For Each prm in rpt.ParameterFields
        prm.ClearCurrentValueAndRange
    Next
    
    '... code to view report

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    12

    Re: parameterized report

    thanks brucevde for your support
    i am new to vb and crystal reports . i am enclosing the code . your help & suggestions are awaited . thanks and regards

    Code:
    ''Dim Report As New CrystalReport1
    Dim rpt As CRAXDRT.Report
    
    Private Sub Form_Load()
    
    Screen.MousePointer = vbHourglass
    ' error at following line < object does not support this property or method >
    CRViewer91.ReportSource = rpt
    Dim prm As CRAXDDRT.ParameterFieldDefinition
    For Each prm In rpt.ParameterFields
        prm.ClearCurrentValueAndRange
    Next
    CRViewer91.ViewReport
    Screen.MousePointer = vbDefault
    
    '' earlier default code
    ''Screen.MousePointer = vbHourglass
    ''CRViewer91.ReportSource = Report
    ''CRViewer91.ViewReport
    ''Screen.MousePointer = vbDefault
    
    End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    12

    Re: parameterized report

    hi

    i searched the net am using the following code


    vb Code:
    1. Me.MousePointer = vbHourglass
    2.     Dim crApp As CRAXDRT.Application
    3.     Dim Report As CRAXDRT.Report
    4.     Dim strSelectionfrm As String
    5.     Set crApp = New CRAXDRT.Application
    6.     Set Report = crApp.OpenReport("D:\KidyFoods\TestReports\report1.rpt") ' ("C:\myCRReport.rpt")
    7.  
    8.     Dim strsel As String
    9.  
    10.  
    11. '    strSelectionfrm = "{Expected_Sales.Dept}='Analyst Group' and {Expected_Sales.Qtr}='Qtr1'"
    12.  
    13. '    strSelectionfrm = " {items.ratetype}='A'"
    14.    
    15.    
    16.    
    17. '    Report.RecordSelectionFormula = strSelectionfrm
    18.    
    19.     strsel = Trim(Text1.Text)
    20.    
    21.     Report.RecordSelectionFormula = "{items.ratetype}=" & strsel
    22.    
    23.    
    24.     Report.DiscardSavedData
    25.     Form2.CRViewer91.ReportSource = Report
    26.     Form2.CRViewer91.ViewReport
    27.     Form2.Show
    28.     Me.MousePointer = vbNormal


    my problem now is i am getting error like :- a number,string,...,etc is expected here on the following line

    Report.RecordSelectionFormula = "{items.ratetype}=" & strsel


    however , if i use the following it works fine :-

    strSelectionfrm = " {items.ratetype}='A'"
    thanks & regards

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2009
    Posts
    12

    Re: parameterized report

    thanks brucevde for all the support

    my problem has be resolved as i also searched the net

    thanks and regards

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