# Re: 一个想透了脑的程式 !!!

Posted by Scott on May 29, 1999 at 16:29:33:

In Reply to: 一个想透了脑的程式 !!! posted by kkcheung on May 29, 1999 at 13:26:38:

: Do While Not tempset.EOF
: temp1 = tempset.Fields!send_name :temp2 = tempset.Fields!CUS_name
: temp3 = tempset.Fields!class_name:temp4 = tempset.Fields!Weight
: Printer.Print Tab(2); temp1; Tab(10); temp2; Tab(40); temp3; Tab(55); temp4
: tempset.MoveNext

: If Not tempset.EOF Then
: If temp1 <> tempset.Fields!send_name Then
: Printer.NewPage
: temp1 = tempset.Fields!send_name
: End If
: End If

: 上面一段程式是如果temp1不相同上一个temp1,便newpage.
: 出来的结果是:
: aaaa,bbbb,cccc,1000
: aaaa,bbbb,cccc,500
: aaaa,bbbb,dddd,200
: aaaa,zzzz,cccc,200
: aaaa,zzzz,cccc,400
: 怎样可以张结果改成
: aaaa,bbbb,cccc,1500
: aaaa,bbbb,dddd,200
: aaaa,zzzz,cccc,600
: 希望大家明白我意思.谢谢!
============================
set rs=db.openrecordset("select [send_name],[cus_name],[class_name],sum([weight]) as nweight _
from tempset group by send_name,cus_name,class_name",dbopensnapshot)
with rs
.movefirst
while not .eof
Printer.Print Tab(2); ![send_name]; Tab(10); ![cus_name]; Tab(40); ![class_name]; Tab(55); ![nweight]
wend
.close
end with

Follow Ups:

- 再请教,我有此不明白? kkcheung 22:05:46 5/29/99 (2)
  - Re: 再请教,我有此不明白? Scott 01:45:46 5/30/99 (0)
  - Re: 再请教,我有此不明白? Scott 01:42:13 5/30/99 (0)