on 06-07-2011 2:50 PM
hi
Im using VBS to transfer Values to CRXI (Runtime Files) to make a PDF print out.
Only the Mainreport is not the problem. When i added a subreport in a Mainreport the subreport remains empty!
What is wrong with my VBS Code?
Dim Appn
Dim Report
Dim fso
Dim path
Dim Subreport
On Error Resume Next
'Scripting
Set fso = CreateObject("Scripting.FileSystemObject")
'Crystal Runtime
Set Appn = CreateObject("CrystalRuntime.Application")
'Data name
path = "productionreport_WFI_day" & "_" & Year(Now) & "_" & Month(Now) & "_" & Day(Now) & "_" & Hour(Now) & "_" & Minute(Now) & "_" & Second(Now)
'Mainreport
Set Report = Appn.OpenReport("Mainreport.rpt")
'Parameters for mainreport
Report.ParameterFields.GetItemByName("From").AddCurrentValue CDate("2011-06-06 00:00:00")
Report.ParameterFields.GetItemByName("Till").AddCurrentValue CDate("2011-06-07 00:00:00")
Report.ParameterFields.GetItemByName("test1").AddCurrentValue CDbl("1.00")
Report.ParameterFields.GetItemByName("test2").AddCurrentValue CDbl("2.00")
Report.ParameterFields.GetItemByName("test3").AddCurrentValue CDbl("3.00")
'Subreport
Set Subreport = Appn.OpenSubreport("Timers") 'Timers = Name of supreport in the mainreport
'Parameters for subreport
Subreport.ParameterFields.GetItemByName("From").AddCurrentValue CDate("2011-06-06 00:00:00")
Subreport.ParameterFields.GetItemByName("Till").AddCurrentValue CDate("2011-06-07 00:00:00")
Subreport.ParameterFields.GetItemByName("test1").AddCurrentValue CDbl("1.00")
Subreport.ParameterFields.GetItemByName("test2").AddCurrentValue CDbl("2.00")
Subreport.ParameterFields.GetItemByName("test3").AddCurrentValue CDbl("3.00")
Report.EnableParameterPrompting = False
Report.ExportOptions.FormatType = 31 ' crEFTPortableDocFormat
Report.ExportOptions.DestinationType = 1 ' crEDTDiskFile
Report.ExportOptions.PDFExportAllPages = True
Report.ExportOptions.DiskFileName = "C:\Report\" & path & ".pdf"
Report.Export (False)
Set fso = Nothing
Set Appn = Nothing
Set Report = Nothing
What is the exact version of CR? (CR XI is not enough).
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Code looks correct.
More code is here;
https://wiki.sdn.sap.com/wiki/display/BOBJ/ReportDesignerComponentSDKCOM+Samples
Also, you may want to search the KBase; text box in top right corner of this web page.
Other than that, go to XI R2A
- Ludek
moved to Legacy SDK forum
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.