Here is some readable code
Dim acctId
acctId = frmAccountDetail.CurrentID
Dim oCR, oCond, oConds, oMV
GlobalReportController.Init
Set oCR = GlobalReportController.CrystalReport
oCR.Family = "Account"
oCR.Name = "Testrpt"
oCR.PluginID = ""
oCR.Reload
Set oCond = New SLXReportCondition
oCond.Table = "ACCOUNT"
oCond.Field = "ACCOUNTID"
oCond.Value = "'" & acctId & "'"
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 |