SELECT 入出库明细.系统号, 入出库明细.发生日期, 库存信息资料.库存编号, 入出库明细.领用单位, 入出库明细.开始号码, 入出库明细.结束号码, 入出库明细.入库数量, 入出库明细.出库数量, 库存信息资料.方向, (select sum(nz(入库数量)-nz(出库数量)) from 入出库明细 AS c where c.系统号<=入出库明细.[系统号] and c.库存编号=入出库明细.单证编号) AS 库存量
FROM 入出库明细 INNER JOIN 库存信息资料 ON 入出库明细.库存编号=库存信息资料.库存编号
WHERE (((库存信息资料.库存编号)=forms!明细账!库存编号))
ORDER BY 入出库明细.系统号;