
Clear content/data from a CRVIEWER object ?
(1) You are dynamically adding Text fields to the report, not data. Thus,
calling DiscardSavedData won't clear those text fields you have added. The
operative word here is Data.
(2) If you want to clear those text fields, you have to call DeleteObject
method. That basically means that you need to go through each object in the
section, and determine if they are the ones you have added, and if they are,
you need to delete them. Quite a lot of code is required to do it. But it's
doable.
(3) Why don't you base your report on SysObjects and SysDepends tables (or
possibly a number of other system tables that are available)? Instead of
adding text fields dynamically, you can use CR as a database retrieval
system, and reporting tool, the way it is intended to be used.
Quote:
> I use the "sp_table <tablename>" stored procedure from SQL-Server:
> .CRViewer1.ReportSource = m_Report
> ....
> StrSQL = "sp_helptrigger '" + DB_Table + "'" // Stored
> Proc.
> Set ps = cn.CreatePreparedStatement("", StrSQL) // cn =
> RDOconnection
> Set rs = ps.OpenResultset(rdOpenStatic) // rs =
> resultset
> ....
> While Not rs.EOF
//
> read complete records
> .....
> With m_Report.Sections(1)
> str = CStr(rs.rdoColumns.Item("trigger_name")) //
> read entry "trigger_name" from Recordset
> Set txt1 = .AddTextObject(str, 0, y_pos) //
> display entry on CRviewer Report
> ....
> CRViewer1.refresh
> CRViewer1.ViewReport // show report
> --denis
> > Which table are you basing your report on? SysObjects?
> > Let's assume that you are using SysObjects. If you only want to show
> > triggers, then you would change the RecordSelectionFormula, to something
> > like {SysObjects.Type}="TR", and then call Refresh method on the
CRViewer
> > object.