|
-
April 28th, 2010, 05:52 AM
#1
How to invoke a Crystal Report Programatically through a VB 6 Activex Component
Hello Gurus,
I am new to Crystal reports. I am given the task of running a crystal report in a specified path without using forms or any user control. I need your help as how to proceed with the same. kindly give me the directions. I have CR XI installed in my machine.
-
April 28th, 2010, 08:47 AM
#2
Re: How to invoke a Crystal Report Programatically through a VB 6 Activex Component
I do not use crystal so I can not be sure about this but I would think shell() may be your answer.
Always use [code][/code] tags when posting code.
-
April 28th, 2010, 01:59 PM
#3
Re: How to invoke a Crystal Report Programatically through a VB 6 Activex Component
Which version of Crystal? The one that came with VB6?
-
April 29th, 2010, 05:08 AM
#4
Re: How to invoke a Crystal Report Programatically through a VB 6 Activex Component
I am using Crystal reports 11 Developer edition, not the one that came with VB. I have figured out how to export the report to a PDF file but I have no idea as how to launch the report through VB code.
The following code snippet I got from the internet and made some changes. this is working fine.
Public Function ExportToPDF(ByVal ReportName As String)
Dim strRptfile, strExportfile
Dim RetValue
Dim strDate
Dim objCRRpt
Dim objCRApp
WriteLog ("ExportRPT: " & ReportName)
strDate = Year(Now()) & "-" & Right("0" & Month(Now()), 2) & "-" & Right("0" & Day(Now()), 2)
RetValue = ""
strRptfile = UCase(ReportName)
strExportfile = Replace(strRptfile, ".RPT", "-" & strDate & ".PDF")
Set objCRApp = CreateObject("CrystalRunTime.Application")
Set objCRRpt = objCRApp.OpenReport(strRptfile)
With objCRRpt
With .ExportOptions
.FormatType = crEFTPortableDocFormat
.PDFExportAllPages = True
.DiskFileName = strExportfile
.DestinationType = crEDTDiskFile
.UseReportDateFormat = True
.UseReportNumberFormat = True
End With
.Export (False)
RetValue = strExportfile
End With
ExportToPDF = RetValue
End Function
Now how do i actually launch the report for printing on a printer.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|