|
大体意思是在窗体中使用子窗体查询.但由于数据量比较大,考虑到直接将源数据记录属于子窗体,窗体加载时速度太慢,现在想通过在执行查询时,再将子窗体的数据源数据属于子窗体.
假如是这样的,在这段代码中插入语句
Me.DBquery.Form.RecordSource ="需插入的SQL语句"
由于过长,需要分行,试了几次用_ 或&_都不行,
望高手指教,需要插入的代码如下:"
SELECT DBBackup.tnoid, DBBackup.tnam, DBBackup.gnam, DBBackup.jial, Sum(DBBackup.xqnum) AS 需求量, Sum(DBBackup.dgnum) AS 订购量, Round(Sum(DBBackup.dgnum)*100/Sum(DBBackup.xqnum),0) & '%' AS 订单满足率, DBBackup.mark1, DBBackup.mark2, DBBackup.formats, DBBackup.scale, DBBackup.ctype, DBBackup.dtype FROM DBBackup GROUP BY DBBackup.tnoid, DBBackup.tnam, DBBackup.gnam, DBBackup.jial, DBBackup.mark1, DBBackup.mark2, DBBackup.formats, DBBackup.scale, DBBackup.ctype, DBBackup.dtype HAVING (((DBBackup.tnoid) Like IIf(IsNull(Forms!自助查询!Text1),'*','*' & Forms!自助查询!Text1 & '*')) And ((DBBackup.tnam) Like IIf(IsNull(Forms!自助查询!Text2),'*','*' & Forms!自助查询!Text2 & '*')) And ((DBBackup.gnam) Like IIf(IsNull(Forms!自助查询!Text3),'*',Forms!自助查询!Text3)) And ((DBBackup.jial) Like IIf(IsNull(Forms!自助查询!Text4),'*',Forms!自助查询!Text4)) And ((Sum(DBBackup.dgnum)) Between IIf(IsNull(Forms!自助查询!Text5),0,Forms!自助查询!Text5*Sum(DBBackup.xqnum)/100) And IIf(IsNull(Forms!自助查询!Text6),5000,Forms!自助查询!Text6*Sum(DBBackup.xqnum)/100)) And ((DBBackup.mark1) Like IIf(IsNull(Forms!自助查询!Text7),'*',Forms!自助查询!Text7)) And ((DBBackup.mark2) Like IIf(IsNull(Forms!自助查询!Text8),'*',Forms!自助查询!Text8)) And ((DBBackup.formats) Like IIf(IsNull(Forms!自助查询!Text9),'*',Forms!自助查询!Text9)) And ((DBBackup.scale) Like IIf(IsNull(Forms!自助查询!Text10),'*',Forms!自助查询!Text10)) And ((DBBackup.ctype) Like IIf(IsNull(Forms!自助查询!Text11),'*',Forms!自助查询!Text11)) And ((DBBackup.dtype) Like IIf(IsNull(Forms!自助查询!Text12),'*',Forms!自助查询!Text12))); |
|