以下是引用片段:
Private Sub btn添加_Click() '1.设置表格样式和标题 '2.以不同的查询模式更新显示列表 '3.计算业务量,总金额和交费金额 '1 Dim arrName() arrName = Array("采购代码", "采购日期", "供应商名称", "总数量", "总金额", "记录人", "备注") Dim arrColwidth() arrColwidth = Array(0, 3000, 3000, 2500, 2000, 2000, 3000) ddd.Cols = 7 ddd.Rows = 2 Dim i As Long For i = 0 To ddd.Cols - 1 ddd.ColWidth(i) = arrColwidth(i) ddd.TextMatrix(0, i) = arrName(i) ddd.TextMatrix(1, i) = "" Next ddd.Rows = 27 '2 Call UpdateDDD(ddd, ExecSql("select cgid,cgrq,khmc,zsl,zje,jlr,bz from cgdj " _ & " where cgrq>='" & Me.DTPicker1.Value & "' and cgrq<='" & Me.DTPicker2.Value & "' " _ & " and khmc like '" & Me.Text1.Text & "%' and jlr like '" & Me.Text2.Text & "%' order by cgrq desc ")) '3 Me.Text3.Text = 0 Me.Text4.Text = 0 Me.Text5.Text = 0 For i = 1 To ddd.Rows - 1 If ddd.TextMatrix(i, 0) <> "" Then Me.Text3.Text = Val(Me.Text3.Text) + 1 End If If ddd.TextMatrix(i, 4) <> "" Then Me.Text4.Text = Val(Me.Text4.Text) + Val(ddd.TextMatrix(i, 3)) End If If ddd.TextMatrix(i, 5) <> "" Then Me.Text5.Text = Val(Me.Text5.Text) + Val(ddd.TextMatrix(i, 4)) End If Next End Sub
|