在CRYSTAL 8中,要打印一份单据,需要在一张A4Z中打印一式两份,每一分的规格为:
字段名1 字段名2 字段名3
1 XX XX XX
2 XX XX XX
3 XX XX XX
也就是说每张单据最多只能有不超过三条记录。那么我用ADO的方法做:
Data2.RecordSource = "select * from main1"
Data2.Refresh
Report.Database.SetDataSource Data2.Recordset
'Report.SQLQueryString = "select * from main1"
Report.DiscardSavedData
While Not Data2.Recordset.EOF
Report.cailiao.SetUnboundFieldSource "{ado.材料名称}"
Report.xinghao.SetUnboundFieldSource "{ado.型号}"
report.xiaoshouprice.SetUnboundFieldSource "{ado.销售单价}"
rReport.gonghuodanwei.SetUnboundFieldSource "{ado.供货单位}"
rReport.gonghuoriqi.SetUnboundFieldSource "{ado.供货日期}"
rReport.shigoushuliang.SetUnboundFieldSource "{ado.实购数量}"
xiaoshouprice1 = Data2.Recordset("销售单价")
zhuan (xiaoshouprice1)
Data2.Recordset.MoveNext
Wend
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
但做出来的效果是每条记录单独占据了一张单据,而不是每张单据至多有三条记录,请问为什么呢?
应该如何解决?
字段名1 字段名2 字段名3
1 XX XX XX
2 XX XX XX
3 XX XX XX
也就是说每张单据最多只能有不超过三条记录。那么我用ADO的方法做:
Data2.RecordSource = "select * from main1"
Data2.Refresh
Report.Database.SetDataSource Data2.Recordset
'Report.SQLQueryString = "select * from main1"
Report.DiscardSavedData
While Not Data2.Recordset.EOF
Report.cailiao.SetUnboundFieldSource "{ado.材料名称}"
Report.xinghao.SetUnboundFieldSource "{ado.型号}"
report.xiaoshouprice.SetUnboundFieldSource "{ado.销售单价}"
rReport.gonghuodanwei.SetUnboundFieldSource "{ado.供货单位}"
rReport.gonghuoriqi.SetUnboundFieldSource "{ado.供货日期}"
rReport.shigoushuliang.SetUnboundFieldSource "{ado.实购数量}"
xiaoshouprice1 = Data2.Recordset("销售单价")
zhuan (xiaoshouprice1)
Data2.Recordset.MoveNext
Wend
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
但做出来的效果是每条记录单独占据了一张单据,而不是每张单据至多有三条记录,请问为什么呢?
应该如何解决?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货