Hi, Expert
Why can't Subreport display all content?
I have a report, it has one mainreport and subreport,
they connect to the same DB(store procedure).
when I used VB code to show this report , mainreport can display well, but subreport
only display partial detail.
#####################################################################
::VB::
sub main()
Public oApp As New CRAXDRT.Application
Public oRpt As CRAXDRT.Report
Dim conn As New ADODB.Connection
Dim mainreport As New ADODB.command,subreport As New ADODB.command
conn.CursorLocation = adUseClient
conn.ConnectionString = "..."
conn.CommandTimeout = 1000
conn.Open
mainreport.ActiveConnection = conn
mainreport.CommandType = adCmdStoredProc
mainreport.CommandText = "Sp_text"
mainreport.CommandTimeout = 1000
mainreport.Parameters.Append command.CreateParameter("flag", adVarChar, adParamInput, 4, "I")
...
Set mrpt = command.Execute
subreport.ActiveConnection = conn
subreport.CommandType = adCmdStoredProc
subreport.CommandText = "Sp_text"
subreport.CommandTimeout = 1000
...
Set srpt1 = Command1.Execute
Call SomRpt_Initial(App.Path & "\RPT\inv_rpt07T.rpt")
oRpt.DiscardSavedData
Call SOMRpt_AppendRecordset("Main;1", mrpt)
Call SOMRpt_AppendSubReport("sub1", srpt1)
CRViewer.ReportSource = oRpt
CRViewer.ViewReport
Exit Sub
end sub
Sub SOMRpt_AppendRecordset(tablename, p_rs)
Dim Table1 As DatabaseTable
Dim oRs As ADODB.Recordset
Set oRs = p_rs
Set Database = oRpt.Database
Set Tables = Database.Tables
Set Table1 = Tables.item(1)
Table1.SetPrivateData 3, oRs
End Sub
Sub SOMRpt_AppendSubReport(Subrptname, p_rs)
Dim Table1 As DatabaseTable
Dim oRs As ADODB.Recordset
Set subrpt1 = oRpt.OpenSubreport(CStr(Subrptname))
Set oRs = p_rs
Set Database = subrpt1.Database
Set Tables = Database.Tables
Set Table1 = Tables.item(1)
MsgBox Table1.Name
Table1.SetPrivateData 3, oRs
End Sub
#####################################################################
::subreport::
[View(Design)]
Report Header
ps.There are three data on report
a. [ATTN: ][inv_rpt07;1.st_ct_name(string)]
b. [Tel : ][inv_rpt07;1.st_ct_tel(string)]
c. [Fax : ][inv_rpt07;1.st_ct_fax(string)]
[formula]
[ATTN: ].if trim({inv_rpt07;1.st_ct_name})="" then "" else "ATTN : "
[Tel : ].if trim({inv_rpt07;1.st_ct_tel})="" then "" else "Tel : "
...
#####################################################################
When I ran the process, mainreport can run well(display all data on report),
but subreport only display partial detail,
like "ATTN : " on the report.
It should be "ATTN: {inv_rpt07;1.st_ct_name}" ...
I think it can display "ATTN : "(although not ATTN: {inv_rpt07;1.st_ct_name} ) which mean
subreport has got the db data from vb, but why can't display all the content on report??
Have any Suggestion??
Thanks & Best Regards