Search Crystal Reports in Visual Studio for table/procedures
03-Aug-0909 Leave a comment
This is a part of the VB proc I built to generates the list of all tables used by my reports. Reports are listed in a ‘reports Table’, and I use a memo field to store the name of all used tables. It is then quite easy to update all requested reports once tables have been modified.
Publicfunction tablesUsedByAReport(myReportName asstring)asstringDim m_report As CRAXDRT.Report, _ m_crystal As CRAXDRT.Application, _ m_tablesUsedByAReport AsStringDim m_table As CRAXDRT.DatabaseTable, _ m_section As CRAXDRT.section, _ m_objet AsObject, _ m_subReport As CRAXDRT.SubreportObjectSet m_crystal =New CRAXDRT.ApplicationSet m_rapport = m_crystal.OpenReport(m_nomRapport,1)'table names in the report'ForEach m_table In m_rapport.Database.tables m_tablesUsedByAReport = m_tablesUsedByAReport & m_table.location &";"Next m_table 'table names in each of the subreports'ForEach m_section In m_rapport.Sections ForEach m_objet In m_section.ReportObjects If m_objet.Kind= crSubreportObject Then Set m_subReport = m_objet Set m_report = m_subReport.OpenSubreport ForEach m_table In m_rapport.Database.tables m_tablesUsedByAReport = m_tablesUsedByAReport & m_table.location &";" Next m_table EndIf Next m_objetNext m_section 'my tables list'tablesUsedByAReport = m_tablesUsedByAReport Endfunction