For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > June 2005 > Change Report source through VB6









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Change Report source through VB6
Ludwig Jr Hemelaer

2005-05-30, 4:01 pm

Applications: Visual Basic 6 with service pack 5 + Crystal Reports 9

I've made a report in Crystal Reports 9 with a database connection to a
Foxpro table (table1.dbf). Opening this report in Visual Basic 6 is no
problem at all, but I want to make it possible for the user to change the
database source of the report by selecting another foxpro database
(table2.dbf).

The database selection is up & running, data component 'DataVerkoop' is the
one with the right database.

How can I modify the report so it takes the 'new' database as source? (the
structure of the new Foxpro database is the same as the one I used to make
the report)

Many thanks!


mthompso

2005-06-08, 4:02 pm

Ludwig Jr Hemelaer wrote:
> Applications: Visual Basic 6 with service pack 5 + Crystal Reports 9
>
> I've made a report in Crystal Reports 9 with a database connection to a
> Foxpro table (table1.dbf). Opening this report in Visual Basic 6 is no
> problem at all, but I want to make it possible for the user to change the
> database source of the report by selecting another foxpro database
> (table2.dbf).
>
> The database selection is up & running, data component 'DataVerkoop' is the
> one with the right database.
>
> How can I modify the report so it takes the 'new' database as source? (the
> structure of the new Foxpro database is the same as the one I used to make
> the report)
>
> Many thanks!
>
>

This is taken from a VB project, but the principle is the same. In the
code portion of the form that loads the report viewer, insert the following:

For i = 1 To Report.Database.Tables.Count
Report.Database.Tables(i).Location = strPathToDB
Next i


where strPathToDB is where the database is located.

Alternately, could you source your database location from the data
component? Or the name of its recordset?

HTH - Miles Thompson
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com