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

How to dynamically change table name?

Status
Not open for further replies.

huckfinn19

Programmer
May 16, 2003
90
0
0
CA
I`m using `.csv` text files as my datasource in a Crystal Report. I`m already using a alias for the name of the database
in my report so that I can change the source files easily.

So lets call the alias DATA_SOURCE.csv an I can change the files from which the data is extracted using
Database->Set Location...->Table : "real_name.csv"

Its pretty easy that way, but I`d like to be prompt for the destination file ("real_name.csv") when I refresh my report.
This so that people using my report wouldn`t have to do all the steps to change the location... It would help also to distribute reports...

Is there a way to do that? Using parameters or something like that?

Thanks!

Simon
 
This may not be practical, but its the only thing I can think of.

Lets say you have three csv files called csv1,csv2,csv3
You could:
1. Create an Access database

2. Link the csv files to the access database - you now have three tables called csv1, csv2 and csv3

3. Create a query that unions the three tables with some sort of identifier added to each record. (So its something like
Select "csv1" as id, csv1.* from csv1
union
select "csv2" as id, csv2.* from csv2
etc

Then you can use the union view from the access database as the datasource and have the id field as a parameter to make sure that the user selects the correct data.


I haven't tried this so I can't guarantee that it works but it might do what you're looking for.

Good Luck.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top