Crystal Report: DB Path manipulation in VB code 
Author Message
 Crystal Report: DB Path manipulation in VB code

Hi everybody,

How do I change the DB path for the tables of a Crystal Report using
DataFiles property of Crystal control in a GENERIC PIECE OF CODE', using
a FOR loop? Or put it that way: how do I get the numbers of tables that
are used in a Crystal Report (needed for my FOR loop)?

Read my thoughts to this below:

In Crystal Reports full path names to the DB have to be indicated for
every table used in the report (ugly, ugly, such things need to be
parameterized using INI-files). This is made at design time of the
report, and so the DB directory at installation time of the software
will be probably different. I understand that I can change the DB
directory using the DataFiles property of the crystal control. The
directory for every table has to be changed separately, writing one line
of code per table used.

I want to write generic code for most of the repeated processes of a
crystal control on a VB form (I work with dozens of reports and do not
want to repeat the code for every crystal control). The problem is that
I do not know at design time how many tables there are in one report, so
I cannot put the directory assignment in a for loop. I do not see any
property that tells me what is the max index for the DataFiles property.
The FOR loop would be like that:

for i = 1 to maxTables
    rptReport.DataFiles(i) = <DB path>
next
(DB path is a variable in my app INI file)

So where do I get the value of maxTables from? This loop has to be
executed before every print of the report. That is quite disturbing. Is
there really no other choice to do it?

It seems to me that Crystal Reports is lacking some parameterization.
Full path usage at design time is an ugly thing to do (normally you let
the user choose to which directory he wants to installo software), that
is why INI-files are existing. Only, how do I get Crystal Reports to
read my INI-file, nor does the component have an own INI-file. It is not
possible, apparently. I actually do not understand what the developers
of the Crystal Report component were thinking, writing that piece of the
software. At least they could have provided a crystal control property
that provides the number of tables used in the report.

Any suggestions or help very welcome

Thomas



Sun, 18 Mar 2001 03:00:00 GMT  
 Crystal Report: DB Path manipulation in VB code
Hi Thomas

I never liked Crystal Reports much (maybe ver 6.0 is better) but .... would
it not be accurate to say that your tables are in a DB (either ODBC or JET,
and I know I am assuming <smile>)

Could you not then iterate through the database, since you know where the
data exists for all your required tables and insert that information into
Crystal OCX ?

Or am I missing the point somwhere ??

Sol.



Quote:
> Hi everybody,

> How do I change the DB path for the tables of a Crystal report using
> DataFiles property of Crystal control in a GENERIC PIECE OF CODE', using
> a FOR loop? Or put it that way: how do I get the numbers of tables that
> are used in a Crystal Report (needed for my FOR loop)?
> The FOR loop would be like that:

> for i = 1 to maxTables
>     rptReport.DataFiles(i) = <DB path>
> next
> (DB path is a variable in my app INI file)

> So where do I get the value of maxTables from? This loop has to be
> executed before every print of the report. That is quite disturbing. Is
> there really no other choice to do it?



Sat, 24 Mar 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Crystal Reports and Path to DB

2. Set the Data Link File path in crystal report by Visual Basic coding

3. Crystal Reports vs VB reports in code

4. changing .mdb path in crystal report using vb 4.0

5. changing .mdb path in crystal report using vb 4.0

6. Crystal Reports - relative path in report file name

7. Can you define report path for crystal reports?

8. Location Of DB in VB for Crystal Reports

9. The way VB/Crystal report use an Access DB

10. The way VB/Crystal report use an Access DB

11. VB App, Crystal Reports, and ODBC and Native db drivers

12. Crystal Reports 8.5 (VB6) to Crystal Reports NET (VB.NET) conversion

 

 
Powered by phpBB® Forum Software