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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal ActiveX Control or RDC

Status
Not open for further replies.

jtrapat1

Programmer
Joined
Jan 14, 2001
Messages
137
Location
US
I'm using CR8 reports against an SQL Server 7 database.
Our Visual Basic application has drop-down menus of about 30 different reports to launch.
Our reports are stored on the server; they won't need any parameters passed to stored procedures.
Ideally, I would like to pass the name of the report and then launch the correct crystal report.
Originally, our application had about 30 crystal report controls dragged onto the form FOR EACH different report.
I found that this slowed down the launching of our main form.
Can someone tell me - what is my best option to correct the "multiple controls on the form" problem?
I started rewriting the code and found that with CR8, a lot of people recommend using the RDC - Report Designer Component.
Do I need to use this or could I stay with the ActiveX Control (crystl32.ocx)?

Thanks in Advance
John
 
You never needed more than one OCX control on the VB form. You can always pass the report name to the OCX object.

The OCX technology was frozen as of V6. The RDC is the new technology and, at least for now, the direction of Crystal Reports. Brian J. Alves
Email: brian.alves@worldnet.att.net
VB / ASP / Crystal / SQLServer
 
Brian,
Thanks for getting back to me.
Listen, I tried passing the report name to the ocx object but it doesn't seem to work.
Can you tell me what I'm doing wrong?

Here's some background:
The report titles are on a drop-down menu bar of a sheridan active toolbar.

Before:
Now,this worked.
The code was simply a SELECT CASE structure and in the toolbar event was one line to launch the correct report:
select case
"Manager"
Manager.Action = 1
"Deputy"
Deputy.Action = 1
and so on, where Manager and Deputy where names of each of the crystal reports controls that were dragged onto the form.

After:
(I dragged one Crystal Report object from the toolbar onto the form.)
I replaced this code with:
select case
"Manager"
With frmMain.CrystalReport1
.ReportFileName = "Z:\btreports\Managers\Manager.rpt"
.Destination = crptToWindow
.Action = 1
End With
"Deputy"
With frmMain.CrystalReport1
.ReportFilename = "Deputy"
.ReportFileName = "Z:\btreports\Deputy\Deputy.rpt"
.Action = 1
End With

When I stepped thru this code,it just ignored the code and didn't launch the report.

In the case of having one .ocx object to hold all of my crystal reports, don't I have to instantiate each New object before I use it?

Something like:
Dim oManager as New CrystalReport1
Dim oDeputy as New CrystalReport1 (and so on for 30 reports)
and then use this object to feed the report path and options?

Thanks in advance.
John

 
When you drop the OCX on a VB form, you have instantiated the object, CrystalReport1 (unless you change the name). You do not need to DIM anything. The object is already there for you.

There's nothing wrong with this code:

With frmMain.CrystalReport1
.ReportFileName = "Z:\btreports\Managers\Manager.rpt"
.Destination = crptToWindow
.Action = 1
End With

I'm assuming that you filled the .Connect property beforehand to connect to the database.

You can keep using the same CrystalReport1 object. I've done it where I've printed a cover letter, packing slip, purchase order, etc., behind one command button on a VB form. Brian J. Alves
Email: brian.alves@worldnet.att.net
VB / ASP / Crystal / SQLServer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top