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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Report 9

Status
Not open for further replies.

svm

Programmer
Apr 26, 2001
44
US
I have a code below and was running when we were using Crystal Report 8. However when we change to Crystal 9, it won't work anymore. Can you tell me why. Thanks.

Option Explicit
Dim Crep As String
Dim CApp As New CRAXDRT.Application
Dim CReport As New CRAXDRT.Report
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path ' Set file list box path.
End Sub
Private Sub File1_DblClick()
openRpt File1.FileName
Crep = File1.FileName
End Sub
Private Sub Form_Load()
On Error Resume Next
Dir1.Path = "G:\PCRM\Reports"
End Sub
Sub openRpt(rptName As String)
Dim ind As Integer
Set CReport = CApp.OpenReport(Crep)
CRViewer91.ReportSource = CReport
'File1.FileName
'CRViewer91.ProgressDialog = True
On Error GoTo comboErr
CRViewer91.PrintReport
CRViewer91.WindowHeight = Screen.Height
CRViewer91.WindowWidth = Screen.Width
'CR1.WindowsAllowDrillDown = True
CRViewer91.WindowAllowDrillDown = True
Exit Sub
comboErr:
MsgBox "Error: " & rptName
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
'Process the appropriate toolbar button and call the
'corresponding menu item
Select Case Button.Key

Case "btnCut"
Call mnuEditCut_Click

Case "btnCopy"
Call mnuEditCopy_Click

Case "btnPaste"
Call mnuEditPaste_Click

Case "btnFind"

Case "btnHelp"

End Select
End Sub
Private Sub mnuEditCopy_Click()
'Ignore errors for combo boxes with a style property of 2
On Error Resume Next

If TypeOf Me.ActiveControl Is TextBox Or _
TypeOf Me.ActiveControl Is ComboBox Then

'Clear clipboard contents
Clipboard.Clear
'Copy contents to clipboard
Clipboard.SetText Me.ActiveControl.SelText

End If
End Sub
Private Sub mnuEditCut_Click()
'Ignore errors for combo boxes with a style property of 2
On Error Resume Next

If TypeOf Me.ActiveControl Is TextBox Or _
TypeOf Me.ActiveControl Is ComboBox Then

'Clear clipboard contents
Clipboard.Clear
'Copy contents to clipboard
Clipboard.SetText Me.ActiveControl.SelText
'Clear contents
Me.ActiveControl.SelText = ""

End If
End Sub
Private Sub mnuEditPaste_Click()
'Ignore errors for combo boxes with a style property of 2
On Error Resume Next

If TypeOf Me.ActiveControl Is TextBox Or _
TypeOf Me.ActiveControl Is ComboBox Then

'Paste contents of clipboard
Me.ActiveControl.SelText = Clipboard.GetText()

End If
End Sub

 
When it does the OpenRpt.
 
I'm not sure. But when U call the report it is include the path and file name (.rpt). The Scheme will be like :

Set CReport = CApp.OpenReport(Crep,1)

and the Crep must be path & report file name ex: "G:\PCRM\Reports\report.rpt"

or

Set CReport = CApp.OpenReport_
("G:\PCRM\Reports\report.rpt",1)

I hope this can solve your problem. I u interest, I have a document about migration from OCX to RDC for Crystal Report 9. Please mail me so I can sent it to you. (andreas@bintang7.com)
 
When I run it, I'm getting a message "Invalid TLV Record".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top