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

name of database onto report 3

Status
Not open for further replies.

samimichaels

IS-IT--Management
Nov 17, 2000
20
US
I use a report with a new database everyday and change the set location. Is there a way to have the name of the database I am connecting to print on the report as a field instead of me retyping it in everyday. I found under special fields that I could put the name of the report, but I need the name of the database.

thanks...

Samantha
 
I'm not aware of a function that does this ... the only way around it was if you were to name your database, maybe based on that days date.

So on the 27th Aug 2000 you ran against database Aug2700.xxx

Then have a formula in the report that worked to the same rule, ie outputing a database filename based on the currentdate, to the screen.

That way as you pointed your report to a new database each day, so long as you named the database in this way, the formula would work the same way and display a matching database name.

HTH

 
What type of database are you connecting to? I have included the statement "SELECT db_name() AS CURR_DB" in the SQL Server view that my report is based upon. Include this field in your report, and when your database changes, the field will reflect the current database.
 
Crystal 8:
Go to insert a field object, create a new SQL Expression Field. Go to System on the Function Tree. Select Database(). Works like a charm. One thing to consider is that sometimes the database names aren't always user friendly. If that's the case just add a Formula Field that uses Case or an If/Then statement that works off the created SQL Expression field...

If dbname = db_conversion_1
then 'Database 1'
else if dbname = db_conversion_2
then 'Database 2'
etc....
 
Using the Database() function in an SQL expression
is dependent on your DBMS supporting that function.

Cheers,
- Ido ixm7@psu.edu
 
Any ideas how to do this in a report that does not use ODBC but uses "Database Files" and Access?

In this enviroment I don't have access to "SQL Expression Fields".

Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top