求助:关于表单grid1浏览显示的问题~
我要在表单中显示两张不同的表数据~~两张是清单.dbf,另两张是汇总.dbf
编程如下:
xm=
do case
case thisform.optiongroup2.value=1
do case
case thisform.optiongroup1.value=1
y=val()
ymd="year(销售日期)=y and c.名称=xm"
case thisform.optiongroup1.value=2
y=val()
m=val()
ymd="year(销售日期)=y and month(销售日期)=m"
case thisform.optiongroup1.value=3
y=val()
m=val()
d=val()
ymd=" year(销售日期)=y and month(销售日期)=m and day(销售日期)=d"
endcase
select c.名称 as "名称",b.名称 as "商品", a.数量 as "数量",a.单价 as "单价",a.折扣 as "折扣", a.数量*a.单价*a.折扣 as "金额" ;
from 销售 a,商品 b,经销商 c ;
where a.经销商=c.编号 and a.商品编码= b.编码 and c.名称=xm and &ymd into dbf cur清单
thisform.grid1.recordsource="cur清单"
thisform.grid1.recordsourcetype=1
thisform.grid1.columncount=6
with thisform.grid1
.column1.header1.caption="名称"
.column2.header1.caption="商品"
.column3.header1.caption="数量"
.column4.header1.caption="单价"
.column5.header1.caption="折扣"
.column6.header1.caption="金额"
.column1.width=60
.column2.width=100
.column3.width=30
.column4.width=50
.column5.width=30
.column6.width=90
endwith
thisform.grid1.refresh
case thisform.optiongroup2.value=2
do case
case thisform.optiongroup1.value=1
y=val()
ymd0=int(y)
ymd="year(销售日期)=y "
case thisform.optiongroup1.value=2
y=val()
m=val()
ymd0=
ymd="year(销售日期)=y and month(销售日期)=m "
case thisform.optiongroup1.value=3
y=val()
m=val()
d=val()
ymd0=
ymd="year(销售日期)=y and month(销售日期)=m and day(销售日期)=d"
endcase
select c.名称 as "名称", ymd0 as "日期", sum(a.数量*a.单价*a.折扣) as "汇总金额" ;
from 销售 a,商品 b,经销商 c ;
where a.经销商=c.编号 and a.商品编码= b.编码 and &ymd and c.名称=xm into dbf cur汇总
thisform.grid2.recordsource="cur汇总"
thisform.grid2.recordsourcetype=1
thisform.grid2.columncount=3
with thisform.grid2
.column1.header1.caption="名称"
.column2.header1.caption="日期"
.column3.header1.caption="汇总金额"
.column1.width=60
.column2.width=70
.column3.width=90
endwith
thisform.grid2.refresh
case thisform.optiongroup2.value=3
do case
case thisform.optiongroup1.value=1
y=val()
ymd="year(销售日期)=y "
case thisform.optiongroup1.value=2
y=val()
m=val()
ymd="year(销售日期)=y and month(销售日期)=m"
case thisform.optiongroup1.value=3
y=val()
m=val()
d=val()
ymd=" year(销售日期)=y and month(销售日期)=m and day(销售日期)=d"
endcase
select c.名称 as "名称",b.名称 as "商品", a.数量 as "数量",a.单价 as "单价",a.折扣 as "折扣", a.数量*a.单价*a.折扣 as "金额" ;
from 销售 a,商品 b,经销商 c ;
where a.经销商=c.编号 and a.商品编码= b.编码 and &ymd into dbf cur清单 order by c.名称
thisform.grid1.recordsource="cur清单"
thisform.grid1.recordsourcetype=1
thisform.grid1.columncount=6
with thisform.grid1
.column1.header1.caption="名称"
.column2.header1.caption="商品"
.column3.header1.caption="数量"
.column4.header1.caption="单价"
.column5.header1.caption="折扣"
.column6.header1.caption="金额"
.column1.width=60
.column2.width=100
.column3.width=30
.column4.width=50
.column5.width=30
.column6.width=90
endwith
thisform.grid1.refresh
case thisform.optiongroup2.value=4
do case
case thisform.optiongroup1.value=1
y=val()
ymd0=int(y)
ymd="year(销售日期)=y "
case thisform.optiongroup1.value=2
y=val()
m=val()
ymd0=
ymd="year(销售日期)=y and month(销售日期)=m "
case thisform.optiongroup1.value=3
y=val()
m=val()
d=val()
ymd0=
ymd="year(销售日期)=y and month(销售日期)=m and day(销售日期)=d"
endcase
select c.名称 as "名称", ymd0 as "日期", sum(a.数量*a.单价*a.折扣) as "汇总金额" ;
from 销售 a,商品 b,经销商 c ;
where a.经销商=c.编号 and a.商品编码= b.编码 and &ymd group by c.名称 into dbf cur汇总
thisform.grid1.recordsource="cur汇总"
thisform.grid1.recordsourcetype=1
thisform.grid1.columncount=3
with thisform.grid1
.column1.header1.caption="名称"
.column2.header1.caption="日期"
.column3.header1.caption="汇总金额"
.column1.width=60
.column2.width=70
.column3.width=90
endwith
thisform.grid1.refresh
endcase
thisform.refresh
但在显示完汇总表后,再想显示清单表时,有部分数据只有列标题,下面没有数据,要从新建立多次才能显示全部数据,这是为什么
啊?