Skip to Content
0
Former Member
Feb 11, 2009 at 12:23 AM

Changing the Tablename of DatabaseFieldObjects

44 Views

Scenario:

Crystal Reports 2008 SDK

I wish to convert some reports so that instead of working off tables they work of a single command table. In order to cut time i would like to programmatically go through the report and change the table names of the database field objects to the new command table. However the property "TableName" is read only. Is there a way to achieve this?

For example I cannot do

' Change location of tables of used fields

Dim oField As CrystalDecisions.CrystalReports.Engine.FieldObject

Dim oFieldSource As CrystalDecisions.CrystalReports.Engine.DatabaseFieldDefinition

For Each oObject In oReport.ReportDefinition.ReportObjects

If oObject.Kind = CrystalDecisions.Shared.FieldKind.DatabaseField Then

oField = oReport.ReportDefinition.ReportObjects(oObject.name)

oFieldSource = oField.DataSource

cString = oFieldSource.TableName

oFieldSource.TableName = "newcommandtable"

End If

Next

Thanks