I experienced this very same problem. In VB you need to work with the CR engine directly. After a lot of poking around and reading the below works for me.
'In this case I'm using a rpt file that
'has been designed using Active Data (Field Definitions Only) as the datasource
'and setting the datasource in code.
Dim crxappl As New CRAXDDRT.Application
Dim crxParamDef As CRAXDDRT.ParameterFieldDefinition
Dim crxParamDefs As CRAXDDRT.ParameterFieldDefinitions
Dim crxrep As CRAXDDRT.Report
Dim bywhat As String 'Will become parameter to be passed
Set crxrep = crxappl.OpenReport(App.Path & "\Reports\" & "MyReport.rpt"
Set crxParamDefs = crxrep.ParameterFields
For Each crxParamDef In crxParamDefs 'Parameters
With crxParamDef
Select Case .ParameterFieldName
Case "StartDate"
.AddCurrentValue (Format(DTPicker1(0).Value, "dd-mmm-yyyy")
Case "EndDate"
.AddCurrentValue (Format(DTPicker1(1).Value, "dd-mmm-yyyy")
Case "User"
.AddCurrentValue (UCase(UserName))
Case "SalesReps"
.AddCurrentValue (selected_reps)
Case "p_Group"
.AddCurrentValue (bywhat)
End Select
End With
Next crxParamDef
crxrep.Database.SetDataSource clsrs.t_rs, 3
crxrep.ExportOptions.DiskFileName = "e:\temp\pdf\" & outputname & ".pdf"
crxrep.ExportOptions.DestinationType = crEDTDiskFile
crxrep.ExportOptions.FormatType = crEFTPortableDocFormat
crxrep.Export False
Set crxParamDefs = Nothing
Set crxrep = Nothing
Set crxappl = Nothing
Exit Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.