For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > March 2006 > CR9.2 Problem with VB6 IDE









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author CR9.2 Problem with VB6 IDE
Ajak

2006-03-16, 9:57 pm

Hello,

I'm using VB6 SP6 and CR 9.2 SP6.

I have this problem with my program and I wonder if anyone else has ever
experienced this.

My project uses CR to display several CR reports authored using CR 9.2 and
saved as *.rpt in the same folder of the application.
From my project, these reports are opened from several parts of my project,
but using the same form containing a CRviewer control.

1. Open VB IDE and load the vb project.
2. Run (F5) the project.
3. Open the report viewer form to show a CR report.
4. Close the report viewer form
5. Exit the project to go back to VB IDE. (Tried exiting using both code
Unload Me and X button)
6. Run (F5) the project again.
7. Open the report viewer form to show any CR report.... -> ZAPPP!! IDE
exits without warning or error message.

I step thru the code and found that the line with problem is when set the
Database recordset of the report object.
Here's one of the code that opens the report viewer form:-

Private Sub cmdReport_Click(Index As Integer)
Dim CRXApplication As CRAXDRT.Application
Dim crxreport As CRAXDRT.Report
Dim rst As ADODB.Recordset
Dim frm As frmCRViewer
Dim SQL As String

If RecordValue("SELECT Count(*) FROM overdues") = 0 Then
MsgBox "There is no overdues to view. If you haven't calculate the
overdues, click on 'Start' first!", vbExclamation
Else
Dim wait As New cWaitCursor
wait.SetCursor

On Error GoTo error_handler

SQL = "OverdueList"
Set rst = New ADODB.Recordset
rst.Open SQL, g_objConn, adOpenStatic, adLockReadOnly,
adCmdStoredProc

Set CRXApplication = New CRAXDRT.Application
Set crxreport = CRXApplication.OpenReport(App.Path & "\overdue.rpt",
1)
crxreport.DiscardSavedData

crxreport.Database.SetDataSource rst <------------ IDE EXITS AT
THIS LINE!!!!

If Index = 0 Then ' view
Set frm = New frmCRViewer
frm.CRViewer.ReportSource = crxreport
frm.CRViewer.ViewReport
wait.SetCursor vbDefault
frm.Show vbModal
Else ' print
crxreport.PrinterSetup mdiWindow.hWnd
crxreport.PrintOut True
End If
End If

cleanup:
Set crxreport = Nothing
Set CRXApplication = Nothing
If Not rst Is Nothing Then rst.Close
Set rst = Nothing
Set frm = Nothing
Exit Sub

error_handler:
MsgBox "An error has occured!" & vbNewLine & vbNewLine &
Err.Description, vbCritical
On Error GoTo 0
GoTo cleanup
End Sub

This problem doesn't occur when running the compiled project.
Can anyone help me please?


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com