如何在Datareport中增加一行合计栏?
czwwh 2003-04-14 03:27:02 我以前做了一张表的样式如下:
| 发货单号 | 客户名称 | 数量 | 金额 |
现在我想增加一行合计栏,显示数量及金额的合计,我在报表中插入了分组标头/注脚(Section1/Section2),我把分组注脚中加入了两个Function控件(Function1,Function2),用于数量及金额的合计。格式设置好了,代码该如何改?
以前的代码如下:
Private Sub cmdPrint_Click()
Dim strSQL As String
Dim rsPS As New ADODB.Recordset
strSQL = "select * from TotalTmp"
rsPS.Open strSQL, cnHhsoft
With drpTotal 'drpTotal为报表名称
Set .DataSource = rsPS
.Orientation = rptOrientPortrait
.Sections("rptDetail").Controls.Item("txtSOCode").DataField = "cSOCode" '发货单号
.Sections("rptDetail").Controls.Item("txtCusName").DataField = "cCusName" '客户名称
.Sections("rptDetail").Controls.Item("txtTnum").DataField = "inum" '数量
.Sections("rptDetail").Controls.Item("txtTSum").DataField = "iSum" '金额
.LeftMargin = 0
.Refresh
.Show 1
End With
End Sub