PDA

Click to See Complete Forum and Search --> : [RESOLVED] VB 6/CR XI "The control is busy downloading data


SamC
Jul 14th, 2006, 07:44 AM
OS =Windows XP Professional SP2
CR version XI Developer Edition
VB6 Enterprise Edition

I have a Form called: frmCRPrint. This is where the CrystalActiveXReportViewer is on.

I am getting the following error when executing the code below.
"The control is busy downloading data"
The table I am using (Table Name: TAKEOUT) only has 10 records in it so I don't understand what is causing this problem. The variable "TOSpecDate" is initialized prior to entering this routine.


Global Module:
Public ReportPath As String
Public craxapp As New CRAXDDRT.Application
Public craxreport As CRAXDDRT.Report
Public ReportName As String

In the Form_Activate of frmCRViewer, I have the following:
Private Sub Form_Activate()
Dim dbTable As CRAXDDRT.DatabaseTable


If ReportName = "InvTakeOut.rpt" And HoldIndex = 0 Then
Set craxreport = craxapp.OpenReport(ReportPath & "\" & ReportName)
craxreport.FormulaSyntax = crCrystalSyntaxFormula
craxreport.RecordSelectionFormula = "{TakeOut.dbToDate} = '" & TOSpecDate & "'"
ElseIf ReportName = "InvPartStatusReport.rpt" Then
.
.
End if
craxreport.DiscardSavedData
> While CrystalActiveXReportViewer1.IsBusy
DoEvents
Wend
> CrystalActiveXReportViewer1.Refresh
> CrystalActiveXReportViewer1.ReportSource = craxreport
> CrystalActiveXReportViewer1.ViewReport
> Set craxreport = Nothing
> End Sub
>
> The error occurs on the "CrystalActiveXReportViewer1.Refresh" command. I let this code run for about 10 minutes. No report was seen.

An early thank you for trying to help.
Sam

Besoup
Jul 14th, 2006, 10:26 AM
Not sure why you are trying to refresh before veiwing the report but this is the code I use:

Set crxReport = crxApp.OpenReport(ReportName)
With crView
.ReportSource = crxReport
.ViewReport
While .IsBusy
DoEvents
Wend
.Zoom "100"
.Visible = True
End With

crView is the control name.

SamC
Jul 14th, 2006, 11:32 AM
Besoup:

This is what I have now:


General Module:
Public ReportPath As String
Public craxapp As New CRAXDDRT.Application
Public craxreport As CRAXDDRT.Report
Public ReportName As String
.
.
.
ReportPath = "D:\Data\xxxx\Inventory"


In the Form_Activate event of frmCRPrint, I have:
Dim dbTable As CRAXDDRT.DatabaseTable
If ReportName = "InvTakeOut.rpt" And HoldIndex = 0 Then
Set craxreport = craxapp.OpenReport(ReportPath & "\" & ReportName)
craxreport.FormulaSyntax = crCrystalSyntaxFormula
craxreport.RecordSelectionFormula = "{TakeOut.dbToDate} = '" & TOSpecDate & "'"
ElseIf ReportName =
.
.
.
End If
craxreport.DiscardSavedData
DoEvents
Set craxreport = craxapp.OpenReport(ReportPath & "\" & ReportName)
With CrystalActiveXReportViewer1
.ReportSource = craxreport
.ViewReport
While .IsBusy
DoEvents
Wend
.Zoom "100"
.Visible = True
End With
End Sub


On this statement: ".ReportSource = craxreport" I am now getting the following error message: 'Method ReportSource of object 'ICrystalReportViewer11 failed'.

Do you see anything wrong with the above?
Thanks,
Sam

Besoup
Jul 14th, 2006, 12:56 PM
hmm

do you need your declarations to be public?

Public craxapp As New CRAXDDRT.Application
Public craxreport As CRAXDDRT.Report

probably the only thing I see that I don't really do. I usually just declare them in the same sub as the code calling the report.

Besides that I don't see anything that is really wrong...

SamC
Jul 16th, 2006, 06:41 AM
Problem Resolved: I wish I could tell you what the problem was but I have no idea except the possibility of a "bad typist" (me) or a illegal blind character. I printed that part of my code and retyped it. It worked.

Thanks for your looks,
Sam