cancel
Showing results for 
Search instead for 
Did you mean: 

CRXI VBS Main + Subreport

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

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]

Former Member
0 Kudos

To built the reports i use Crystal Reports CR Developer 11.0.0.1282

On an other pc only Crystal Reports XI Runtime Files is installed.

With the help of a VBS-Script on this pc i transfer values to the Report and print them out.

Edited by: rapt6rr on Jun 8, 2011 8:46 AM

former_member183750
Active Contributor
0 Kudos

You are working with a very, very early version of CR XI R1. I would highly recommend upgrading to CR XI R2A. See [this|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/24977] [original link is broken] [original link is broken] [original link is broken]; for details.

- Ludek

Former Member
0 Kudos

Do you have a solution for my problem?

former_member183750
Active Contributor
0 Kudos

Read my reply posted: Jun 8, 2011 6:29 AM.

- Ludek

Former Member
0 Kudos

Because of some internal reasons im not able to update my Crystal Reports.

My actual porblem is to find out whether the VBS Code, which i have written above is correct or not?

former_member183750
Active Contributor
0 Kudos

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

Answers (1)

Answers (1)

0 Kudos

moved to Legacy SDK forum