Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Code for running a report

Status
Not open for further replies.

LisaAH

IS-IT--Management
Aug 21, 2003
14
0
0
GB
Hi

Does anyone have a script that can run a specific crystal report.

Could this then be made into a .EXE file.

Lisa
 
is crystal reports an exe that can be started passing it the parameters of the report one wished to run?
 
Hi

Thanks for the reply, what I want to do is have an .exe file that prints out a Crystal Report with a .RPT extension from within another application, I just want to put the .exe on a toolbar then users can just click it and it prints out the report.

Thanks

Lisa
 
what happens if you double click on a .RPT file?
 
Hi

An .RPT file is just the extension that Crystal Reports gives to a report.

Lisa
 
anyway, dont answer my question then!!!!

SET oCRApp = Createobject("crystal.crpe.application")
SET oReport = oCRApp.OpenReport("C:\MyPath\MyReport.rpt")
oReport.ParameterFields(0) = 2 'set 1st parm value to 2
oReport.ExportOptions.FormatType = 14 'to Word doc
oReport.ExportOptions.DiskFileName = "C:\MyPath\MyDoc.doc"
oReport.ExportOptions.DestinationType = 1
oRep.Export False 'True to see dialog
SET oReport = Nothing
SET oCRApp = Nothing

this is from an earlier post, it exposes the crystal report app object and you can do 'stuff' with it, there must be a
oReport.Print or something of that nature

if not then as i said if there is a crystalreport.exe like you would find with winword.exe then you might be able to do something like
crystalreport.exe "c:\report.rpt" /print
 
Thanks very much, how can I make this bit of code into a .exe file.

Lisa
 
you are in a vbscript forum, save the code in notepad and save it as report.vbs, double click on this report.vbs and see if it does what you want.

you might want to consider something like
SET oCRApp = Createobject("crystal.crpe.application")
SET oReport = oCRApp.OpenReport("C:\MyPath\MyReport.rpt")
oReport.PrintOut()

'if that doesn work then try exporting it to a word doc 'and print it out that way, shouldnt be needed though

if you really need an exe, which i dont think you actually do, a shortcut pointing to the vbscirpt file will be enough, anyway if you want an exe then install .net or visual studio or SMS installer or whatever dev enviroment floats your boat and complile the code into an exe, but as i say the vbscirpt should do you. and getting back to my first post that if the crystalreportss.exe

saying that i might be the thickest person around and all your users dont have crystal reports installed on their machines, who knows if they ahve the dll the vbscript needs to point to, blaa blaa blla

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top