Overridden Qualified Table Names

Wednesday 29 October 2008 @ 2:32 pm

Many of you have purchased my guide to using Crystal Reports in VB (v6) or my guide to using Crystal Reports in VB.NET. In those guides I cover the basics of configuring and running a report from within an application. I also explain how to change the basic features of the report (groups, parameters, formulas, etc.) and how to log the report into a secured database.

One thing that isn’t currently described is how to log the report into a connection that is different than the connection used at design time. While the code is the same, there is one thing you have to do within the report itself to allow it to work. In version 9 and later you have to set the “Overridden Qualified Table Name” property for all tables in your report. If you don’t do this, the report will keep trying to get data from the tables used at design time.

Some of you may remember that when we set the location of a table in older versions of Crystal we occasionally had to remove the ‘owner’ from the connection information. What is described above is the equivalent step in the current versions of CR. What I find odd about this is that 99% of the time the value you enter for this property is simply the table name. Since Crystal already puts the table name into the table alias property, you would think they could also fill the “Overridden Qualified Table Name” property wth the table name as well. That wouldn’t affect the reports that are run standalone, but it might cut down on confusion among developers.

There is also the alternative method of dealing with this issue: writing a loop of code that sets this property for every table at runtime. Below is some example code taken from a forum page that no longer available:

For all tables in the report you can do:

dbTable.SetLogOnInfo TheServer, TheDB, “<User_ID>”, “<PWD>”
dbTable.Location = TheDB & “<Table_Owner>” & dbTable.Name

dbTable is a reference to a table in the report
Table_Owner is the owner of that table e.g. “dbo”.

Leave a Reply

Recrystallize Pro