Dear friend i make a module which open a crystal report in vb 6.0 .

The report works fine for first time but for second time it hangs. i have to restart the software every time to get the report. below is my code.


Code:
Option Explicit
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset


Private Sub Form_Load()


Dim Appl As New CRAXDRT.Application
Dim Report As New CRAXDRT.Report


 
 CrystalActiveXReportViewer1.Top = 0
 CrystalActiveXReportViewer1.Left = 0
 CrystalActiveXReportViewer1.Height = 12336
 CrystalActiveXReportViewer1.Width = 15408
 Set Report = Appl.OpenReport(App.path & "\PO_Report.rpt")
 cn.CursorLocation = adUseClient
 cn.ConnectionString = "Provider=SQLOLEDB.1;Password=mypass;Persist Security Info=True;User ID=myid;Initial Catalog=abc;Data Source=my.dummy.com"
 cn.Open
 rs.CursorLocation = adUseClient
 rs.Open "Select * from rpt_PUR_rm_order", cn, adOpenDynamic, adLockReadOnly, adCmdText
 Report.DiscardSavedData
 Report.Database.SetDataSource rs

 CrystalActiveXReportViewer1.ReportSource = Report
 CrystalActiveXReportViewer1.ViewReport
 
 

End Sub

Private Sub Form_Unload(Cancel As Integer)
Unload frmReport_module
If rs.State = 1 Then rs.Close
 If cn.State = 1 Then cn.Close
 
 'Set App1 = Nothing
 
 Set rs = Nothing
 Set cn = Nothing
 
 Set frmReport_module = Nothing
End Sub

can anyone tell me what is the error in this report. why the whole software needs to be restarted to get the report each time.


thanks in advance

Shiv Preet