
VB6 (SP5) and CR 8.5 Dev Problems...
Hi All:
I am having several issues with the above setup.
Here is the skinny on the worst one (IMHO)...
I have the following code set up with the CRViewer:
(WARNING - LONG POST!!!)
Dim crApp As New CRAXDRT.Application
Dim crRpt As CRAXDRT.Report
Dim SQL As String
Dim i As Integer
Private Sub CRView_CloseButtonClicked(UseDefault As Boolean)
Set crRpt = Nothing
Set crApp = Nothing
End Sub
Private Sub CRView_ExportButtonClicked(UseDefault As Boolean)
'Constant Procedure name
Const PROCEDURE_NAME As String = "CRView_ExportButtonClicked"
'If an error occurs, go to the Handler
On Error GoTo ERROR_HANDLER
' CRView.ReportSource = crRptEx
With crRpt
.ExportOptions.DestinationType = crEDTDiskFile
.ExportOptions.DiskFileName = App.Path & "\Data\" & GetProperName
& " Estiamte.PDF"
.ExportOptions.formatType = crEFTPortableDocFormat
.ExportOptions.PDFExportAllPages = True
End With
crRpt.Export False
Exit Sub
'The error handler
ERROR_HANDLER:
If Err.Number = 3021 Then
Err.Clear
'Exit Sub
Resume Next
Else
ErrMsg Err.Number, Me.name, PROCEDURE_NAME, True
If Err.Number = 3706 Then
'No provider
Unload Me
Exit Sub
End If
Err.Clear
End If
Resume Next
End Sub
Private Sub CRView_PrintButtonClicked(UseDefault As Boolean)
'Constant Procedure name
Const PROCEDURE_NAME As String = "CRView_PrintButtonClicked"
'If an error occurs, go to the Handler
On Error GoTo ERROR_HANDLER
crRpt.PrintOut False
Exit Sub
'The error handler
ERROR_HANDLER:
If Err.Number = 3021 Then
Err.Clear
'Exit Sub
Resume Next
Else
ErrMsg Err.Number, Me.name, PROCEDURE_NAME, True
If Err.Number = 3706 Then
'No provider
Unload Me
Exit Sub
End If
Err.Clear
End If
Resume Next
End Sub
Private Sub Form_Load()
'Constant Procedure name
Const PROCEDURE_NAME As String = "Form_Load"
'If an error occurs, go to the Handler
On Error GoTo ERROR_HANDLER
'initialize the global variables
Me.Caption = Me.Caption & " " & GetCurName
Set crRpt = crApp.OpenReport(App.Path & "\Data\Estimate.rpt")
For i = 1 To crRpt.Database.Tables.Count
crRpt.Database.Tables(i).SetLogOnInfo "", "", "", "mortar"
Next
crRpt.RecordSelectionFormula = "{Estimate.CustID_FK}= " & intCustID
CRView.ReportSource = crRpt
CRView.ViewReport
Exit Sub
'The error handler
ERROR_HANDLER:
If Err.Number = 3021 Then
Err.Clear
'Exit Sub
Resume Next
Else
ErrMsg Err.Number, Me.name, PROCEDURE_NAME, True
If Err.Number = 3706 Then
'No provider
Unload Me
Exit Sub
End If
Err.Clear
End If
Resume Next
End Sub
I can see the report in the viewer just fine, but when I click on exoprt it:
1) Exports as I would expect
2) Asks what type of Export/File Destination, as if I never did anything
How can I kill step #2 from happening?
After either exporting or printing I want to have the viewer close
auto-magically. I am lost as to how to do that.
Next issue:
My main environment is a W2K SP2 machine. Occassionaly I must work from
home. I put the code directory (Everything is under one subdir/folder) onto
my WinME laptop, and everything EXCEPT the CRViewer is working.
It loads and runs, but when I click the ""Print" button (cwhich calles the
above form) I get a :
Error Opening File.
File could not be found: "Estimate". at location: "Estimate"
I am confused. NOTHING is different outside of the OS/ I am using the same
instalkl of CR and VB6 SP5! :-(
Help?!?!?!
Thank you,
Chris Anderson