I have a crystal report and was successful in passing a condition using the BasicFunctions.ReportAddCondition I however need more control over the crystal to do a few things
1) I need to pass a value into crystal, this is a value that isn't stored in the database so I can't pull it within Crystal
2) I need to figure out a way to generate the file name it exports to PDF as, right now when you export to PDF it tries to save it to the report ID
I've searched all day and I have seen and attempted many methods but can't seem to get anything to work. Currently the following code is what I'm working with:
Sub btnPrintQuoteClick(Sender)
Dim oppid
oppid = Application.BasicFunctions.CurrentOpportunityID
Dim oCR, oCond, oConds GlobalReportController.Init Set oCR = GlobalReportController.CrystalReport oCR.Family = "Opportunity" oCR.Name = "Quote2" oCR.PluginID = "" oCR.Reload
Set oCond = New SLXReportCondition oCond.Table = "Opportunity" oCond.Field = "OPPORTUNITYID" oCond.Value = "'" & oppId & "'"
Set oConds = oCR.ReportConditions() oConds.Add oCond oCR.ReportConditions = oConds stop
oCR.RDC.ParameterFields.Item(0).ClearCurrentValueAndRange oCR.RDC.SetParameterValue "TestField", "test param"
On Error Resume Next
GlobalReportController.ExportReportTo "Preview", ""
If Err.Number <> 0 Then MsgBox "Error Exporting The Report" & vbCRLF & "Description: " & Err.Description & vbCRLF & "Source: " & Err.Source, vbOKOnly + vbCritical, "ERROR" Err.Clear Exit Sub End If End Sub
The line that's throwing the error is "oCR.RDC.ParameterFields.Item(0).ClearCurrentValueAndRange" and the only error is "An error occured executing active form script" and references the line number of this line. If I comment it out, I get an error on the the next line saying "Object doesn't support this property or method: 'oCR.RDC.SetParameterValue'" so I'm guessing the examples I'm trying to follow don't apply to SalesLogix 8.0. Finally, if I comment out both of those lines, It does fire a report but there is no data as if the conditions being supplied aren't generating any results. Could anyone point me in the right direction or provide an example because I'm really at a loss here.
Thank you. |