Skip to Content
avatar image
Former Member

Call a report that was in a different form

What is the correct way to call a report that was in a different form?

This is my current code

Dim frmImprimeComprobante As New AdvancedReports.frm_RptRecepMerc

frmImprimeComprobante.ShowDialog()

frmImprimeComprobante.CrystalReportViewer1.SelectionFormula = "{tbRecepcionEnc.fdRecepcion} =" & 26 & "" & _

" and {tbRecepcionEnc.fdCodigoProveedor} =" & 4 & "" & _

" and {tbRecepcionEnc.fdCodigoMovimiento} =" & 1 & ""

frmImprimeComprobante.CrystalReportViewer1.ReportSource = "
AdvancedReports\AdvancedReports\RptRecepMerc.rpt"

frmImprimeComprobante.CrystalReportViewer1.RefreshReport()

But displays the following error:

Error 1 'AdvancedReports.frm_RptRecepMerc.Private Dim WithEvents CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer' is not accessible in this context because it is 'Private'.
Glauco\TI Backup\Proyectos\Advanced\AdvancedDaily\AdvancedDaily\frm_Recepcion.vb 513 9 AdvancedDaily

Thanks from Costa Rica

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Sep 25, 2008 at 08:16 PM

    Hi,

    Basically we call the report in the form where the viewer control is placed, however in your case we can pass the report document object from a global variable or a session (in case of web application.

    More over how does it behave when you try using this statement:

    CrystalReportViewer1.ReportSource = "
    AdvancedReports\AdvancedReports\RptRecepMerc.rpt"

    Does it help?

    Regards,

    AG.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2008 at 10:08 PM

    Declare it as public or protected.

    Add comment
    10|10000 characters needed characters exceeded