|
4#
楼主 |
发表于 2011-12-23 21:47:44
|
只看该作者
- Dim qr As DAO.QueryDef
- Dim str_before As String
- Dim str_add As String
- Dim str_after As String
- str_before = "SELECT 费用类投入月度发生.发生月度, 费用类投入年度预算.大类别, 费用类投入年度预算.小类别, 费用类投入年度预算.项目明细, 费用类投入月度预算.月度预算(万元), 费用类投入月度发生.月度发生额(万元), [费用类投入年度预算]![年初预算(万元)]+[费用类投入年度预算]![年中预算调整额(万元)] AS [年度总预算(万元)], [月度发生额(万元)]-[月度预算(万元)] AS [当月预算偏差(万元)], Round([月度发生额(万元)]/[月度预算(万元)],4) AS 当月预算发生率, Round([月度发生额(万元)]/[年度总预算(万元)],4) AS 年度预算发生比率 FROM (费用类投入年度预算 INNER JOIN 费用类投入月度发生 ON 费用类投入年度预算.项目明细=费用类投入月度发生.项目明细) INNER JOIN 费用类投入月度预算 ON (费用类投入月度发生.项目明细=费用类投入月度预算.项目明细) AND (费用类投入月度发生.发生月度=费用类投入月度预算.计划月度)"
- str_add = " WHERE 费用类投入月度发生.发生月度 BETWEEN 1 AND " & Me.cmb月.Value
- str_after = str_before & str_add
- Set qr = CurrentDb.QueryDefs("费用类投入预算发生总计数据来源")
- qr.SQL = str_after
- Me.Child11.Form.Requery
复制代码 |
|