|
-
Aug 24th, 2009, 03:34 AM
#1
Thread Starter
New Member
[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
-
Aug 24th, 2009, 01:56 PM
#2
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
-
Aug 26th, 2009, 03:02 AM
#3
Thread Starter
New Member
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
-
Aug 26th, 2009, 04:50 AM
#4
Thread Starter
New Member
Re: parameterized report
hi
i searched the net am using the following code
vb Code:
Me.MousePointer = vbHourglass Dim crApp As CRAXDRT.Application Dim Report As CRAXDRT.Report Dim strSelectionfrm As String Set crApp = New CRAXDRT.Application Set Report = crApp.OpenReport("D:\KidyFoods\TestReports\report1.rpt") ' ("C:\myCRReport.rpt") Dim strsel As String ' strSelectionfrm = "{Expected_Sales.Dept}='Analyst Group' and {Expected_Sales.Qtr}='Qtr1'" ' strSelectionfrm = " {items.ratetype}='A'" ' Report.RecordSelectionFormula = strSelectionfrm strsel = Trim(Text1.Text) Report.RecordSelectionFormula = "{items.ratetype}=" & strsel Report.DiscardSavedData Form2.CRViewer91.ReportSource = Report Form2.CRViewer91.ViewReport Form2.Show 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
-
Aug 26th, 2009, 05:23 AM
#5
Thread Starter
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|