Hi to all:
Hi have this code to print a report without see the report:
I can print the report just one time,because the second time,i try to print,i got this error:Code:Private Sub Command11_Click() Dim rpt As CRAXDRT.Report Set Report = New CRAXDRT.Application Set rpt = Report.OpenReport(App.Path & "\Ficha_Inscricao.rpt") If (rpt.HasSavedData) Then rpt.DiscardSavedData rpt.EnableParameterPrompting = False nomeclube = frmopcoesgerais.Text5(1).Text morada = (frmopcoesgerais.Text5(2).Text) + " " + (frmopcoesgerais.Text5(3).Text) + " " + (frmopcoesgerais.Text5(4).Text) nomeexposicao = frmopcoes.Text1(8).Text dataexposicao = frmopcoes.Text1(10).Text Dim myTextObject As CRAXDRT.TextObject Set myTextObject = rpt.Sections("PH").ReportObjects("Text1") myTextObject.SetText (nomeclube) rpt.ParameterFields.GetItemByName("secao1").AddCurrentValue (frmgestaoexposicao.Combo2(1)) rpt.ParameterFields.GetItemByName("secao2").AddCurrentValue CRViewer1.ReportSource = rpt rpt.PrintOut False End Sub
Run time error:
Method 'ReportSource' of object 'ICrystalreportviewer11' failed
Anyone know why this happen?
Thanks




Reply With Quote