Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Crystal Reports OCX


Message #1 by John Walborn <JWalborn@m...> on Tue, 10 Apr 2001 12:57:27 -0600
Oh, and for others needing help with Crystal Reports and the interface
between it and VB 6.0, I highly suggest the purchase of a book called:

The Complete Reference
Seagate Crystal Reports 8
by George Peck
(Osborne / McGraw-Hill)

It's $49.99, but very good...

-----Original Message-----
From: Kim, Cardyin [mailto:CKim@s...]
Sent: Thursday, April 12, 2001 9:41 AM
To: professional vb
Subject: [pro_vb] RE: Crystal Reports OCX


Oh, the designer has all the advantages of a class.
As long as you keep the structure of the report
the same, you can change formulas, record selections,
send parameters, etc on different instances of the
report.

If you need more than one crystal report structure
then simply just add another RDC.

Also, at least in CR 8.0 and up, you can pass the
Crystal Report a dynamic data source.  Meaning
you can simply say something like:

rptReport.Database.AddOLEDBSource DataEnvironment1.Connection1,"Customer"

and dynamically add a connection you 
created in a data envrionment into your
report.

Cardyin

--------------------------------------
Cardyin Kim
C/S & Web Development Analyst
Information Services
San Antonio Community Hospital
ckim@s...     (xxx)xxx-xxxx     
--------------------------------------


-----Original Message-----
From: John Walborn [mailto:JWalborn@m...]
Sent: Thursday, April 12, 2001 6:00 AM
To: professional vb
Subject: [pro_vb] RE: Crystal Reports OCX


Is the designer made specifically to support one report at a time or can I
somehow load multiple reports into it? I am needing about 15 different
paramterized (by date range, matching data) reports created.

-----Original Message-----
From: Kim, Cardyin [mailto:CKim@s...]
Sent: Tuesday, April 10, 2001 3:53 PM
To: professional vb
Subject: [pro_vb] RE: Crystal Reports OCX


John,

Looks like you are in a jam.
Let me go over the basics really quickly.

The RDC object inside of Visual Basic 6.0
is a crystal report designer that allows
for you to design crystal reports from
inside VB.

It looks like you were able to create
a VB project.  If you want to view the
crystal report before you print,
then you would allow the wizard to
automatically create a viewer form
for you.

Regardless, since you are short on time
you should take this route.  The form
will automatically handle the
resizing and other things.  You can
set the properties of the viewer control
to give the user print, export, zoom
buttons as well as some others.

If you are using a datasource such as
MSSQL, you may be experiencing some
problems.  You need to tell the
instance of the class where to
get the data, and what username
and password to use.  Also if you are
using a file based database such as
MS Access, you may need to specify
where the file will reside runtime.

To do this, follow these steps:

1) Open the RDC window with the
	report that you are working on.
2) Right click on an empty area in the
	tree bar on the left.
3) Click Database->Conver Database Driver
4) Make sure that you choose the driver
	that is closest to the one you
	are connecting to.
	MSSQL for SQL Server
	DAO for Access Databases
5) Enter the appropriate authentication
	information for development environment.
	For SQL servers, you only need to 
	specify database name if you are using
	a trusted connection.
6) Close the RDC window.

Now we must set the database runtime
	authentication and or path information
	in code:

1) Right before you view, print, or export
	the report add the following code:

For SQL Server:

Dim MyCRTable As CRAXDRT.DatabaseTable

For Each MyCRTable In <yourreportinstance>.database.Tables
  Call MyCRTable.SetLogOnInfo("ServerName", "Database", "User", "Password")
Next MyCRTable


For MS Access:

Dim MyCRTable as CRAXDRT.DatabaseTable

For Each MyCRTable In <yourreportinstance>.database.Tables
  Call MyCRTable.SetTableLocation("FullPath",MyCrTable.Name,"")
Next MyCRTable


At this point let me know if you have any
specific questions, I will answer them
as I can.  Feel free to email me
directly if need be, I will answer them
as long as I am at work.

Cardyin

--------------------------------------
Cardyin Kim
C/S & Web Development Analyst
Information Services
San Antonio Community Hospital
ckim@s...     (xxx)xxx-xxxx     
-------------------------------------- 

  Return to Index