Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of same CRViewer for multiple reports

Status
Not open for further replies.

akn

Programmer
Jan 8, 2002
4
OM
Hi everybody,

I created more than one report and I created only one form which holds CRViewer. But In the declaration section the variable can be assigned to one report at a time. How to assign more than one report to this variable?

Dim Report As New Rpt_ChartOfAc

Private Sub Form_Load()
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault

End Sub

I want to use the variable 'Report' for multiple reports. How is it possible?
Thanks in advance.
 
Hi,

Below is a snippet of code that I used in a visual foxpro form that allowed me to select multiple forms. I hope this helps you.
**********************************************************
public crapplication
public crreport

crapplication = createobject("crystalruntime.application")
crreport = createobject("crystalruntime.report")

doc = 'RPT'
**********************************************************
** this Microsoft Windows function allows me to select the report **
** however, it may be different in VB
**********************************************************
mpath = GETFILE(doc, 'Report File:', 'Select', 0,'Select Report File')

if empty(Mpath)
thisform.release
endif

crreport = crapplication.openreport(mpath)

thisform.olecontrol1.reportsource = crreport

thisform.olecontrol1.viewreport
 
Hi,

Below is a snippet of code that I used in a visual foxpro form that allowed me to select multiple forms. I hope this helps you.
**********************************************************
public crapplication
public crreport

crapplication = createobject("crystalruntime.application")
crreport = createobject("crystalruntime.report")

doc = 'RPT'
**********************************************************
** this Microsoft Windows function allows me to select the report **
** however, it may be different in VB
**********************************************************
mpath = GETFILE(doc, 'Report File:', 'Select', 0,'Select Report File')

if empty(Mpath)
thisform.release
endif

crreport = crapplication.openreport(mpath)

thisform.olecontrol1.reportsource = crreport

thisform.olecontrol1.viewreport
 
Hello,
I don't want the user to select different report. I will have input forms for each report and according to the input form the appropriate report should be loaded in the same CRViewer. Is there any way to do this in VB?
 
You can use the ReportSourceRouter property. Look it up in your help, or Crystal's Kbase: c2004679 Best Regards,
Jonathan
 
At the module level, add the statement

Public Report As CRAXDRT.Report

Remove the statement

Dim Report As New Rpt_ChartofAc

Then, in each input form for each report, just add

Set Report = New (Name of Report)

HTH

Nelson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top