You don't need the viewer, just reference the cr craxdrt library
Code:
Public CRApplication As New CRAXDRT.Application
Public CRReport As New CRAXDRT.Report
.
.
.
Set CRReport = CRApplication.OpenReport(App.Path & "\xxxx.rpt", 1)
CRReport.ExportOptions.FormatType = crEFTPortableDocFormat
CRReport.ExportOptions.DestinationType = crEDTDiskFile
CRReport.ExportOptions.DiskFileName = App.Path & "\xxxx.pdf"
CRReport.Export False
Can you help me with my problem. its the same with that you instructed in this thread. heres the code
Private Sub cmdView_Click(Index As Integer)
Select Case Index
Case 0
If Me.optRR(0).Value = True Then irisreports (16)
If Me.optRR(1).Value = True Then irisreports (17)
If Me.optRR(2).Value = True Then irisreports (18)
If Me.optRR(3).Value = True Then irisreports (19)
If Me.optRR(4).Value = True Then irisreports (20)
If Me.optRR(5).Value = True Then irisreports (21)
If Me.optRR(6).Value = True Then irisreports (22)
If Me.optTransfer(0).Value = True Then irisreports (23)
If Me.optTransfer(1).Value = True Then irisreports (24)
If Me.optTransfer(2).Value = True Then irisreports (25)
If Me.optTransfer(3).Value = True Then irisreports (26)
If Me.optTransfer(4).Value = True Then irisreports (27)
If Me.optTransfer(5).Value = True Then irisreports (28)
If Me.optTransfer(6).Value = True Then irisreports (29)
Case 1
If Me.optEndingInv(0).Value = True Then irisreports (12)
If Me.optEndingInv(1).Value = True Then irisreports (13)
If Me.optEndingInv(2).Value = True Then irisreports (14)
If Me.optEndingInv(3).Value = True Then irisreports (15)
If Me.optEndingInv(4).Value = True Then irisreports (33)
Case 2
If Me.optCGS.Value = True Then
generateAverageCost
irisreports (30)
End If
If Me.optSalesSummary(0).Value = True Then irisreports (31)
If Me.optSalesSummary(1).Value = True Then irisreports (32)
'mat 08082006
If Me.optReportToGenerate(6).Value = True Then irisreports (46)
If Me.optReportToGenerate(0).Value = True Then irisreports (35) 'product breakdown
If Me.optReportToGenerate(1).Value = True Then irisreports (36) 'daily sales report net
If Me.optReportToGenerate(2).Value = True Then irisreports (40) 'daily sales report gross
If Me.optReportToGenerate(3).Value = True Then irisreports (37) 'tender department
If Me.optReportToGenerate(4).Value = True Then irisreports (38) 'sales register
If Me.optReportToGenerate(5).Value = True Then irisreports (39) 'gross profit
If Me.optSalesReceiptsWithTender.Value = True Then irisreports (60)
If Me.optSalesReceiptNumbers.Value = True Then irisreports (61)
If Me.optVATSales.Value = True Then irisreports (63)
Case 3
If Me.optJournal.Value = True Then irisreports (34)
Case 4
If Me.OptInventoryAdjustment.Value = True Then irisreports (62)
End Select
End Sub
hope you can help me with this one. thanks in advance.
Public Sub generateReport(ByVal vSqlstring As String)
Dim rstTemp As New ADODB.Recordset
On Error GoTo errSub
Me.MousePointer = vbHourglass
With rstTemp
If .State = adStateOpen Then .Close
.CursorLocation = adUseClient
DoEvents
.Open vSqlstring, cn(1), 3, 3
If .RecordCount > 0 Then
End If
frmDispReport.lblRecordTotal.Caption = "Total number of records : " & .RecordCount
End With
Set frmDispReport.dtgReport.DataSource = rstTemp
Set rstTemp = Nothing
Me.MousePointer = vbDefault
Exit Sub
errSub:
MsgBox Err.Description & " generatereport"
ErrorHandler Err.Number, Err.Description, "generatereport-inventory transactions"
Resume Next
End Sub
Your project is using Crystal Reports version 8.5 or lower and using the OCX control
In order to solve your problem to automatically export to pdf, you should upgrade to Crystal Reports version 10 or 11 and also modify your project acordingly
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
Hi is there an alternative? it actually exports on pdf via crystal report. the problem with that is if it goes directly to crystal report it shows the data of the report before you can export it to pdf. is there a way where i can generate the report but hide the details of the report when it is viewed? so i wont need to upgrade it to CR 10 or 11.
I remember I had the same problems several years ago (almost 12) and the solution I posted was the easiest and fastest
If your code is organized in procedures, you need to change only a few lines and add a reference to CR...
You actually use OCX and you should use RDC... here's an small document to read
Last edited by jggtz; Apr 9th, 2015 at 09:50 PM.
Reason: ...add an attachment...
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
Thanks for that info sir. However I don't have that much knowledge in programming language. But I'll look into the file you sent me. If I didn't get it right would you be interested to have this requirement done for me. I'm willing to pay for the job if your interested. Thanks and regards. (: