个数据组合,后再生成自动序号,因销售订单是TEXT。所以用不了以下VBA
SELECT a.单号ID, a.销售订单, (select count(*) from S排产指令单明细 as b where b.单号ID=a.单号ID and b.销售订单<=a.销售订单) AS 序号
FROM S排产指令单明细 AS a
GROUP BY a.单号ID, a.销售订单;
查询 [A]: SELECT S排产指令单明细.单号ID, S排产指令单明细.销售订单
FROM S排产指令单明细
GROUP BY S排产指令单明细.单号ID, S排产指令单明细.销售订单;
查询:SELECT A.单号ID, A.销售订单, DCount("[销售订单]","A","[单号ID]=" & [单号ID] & " and [销售订单<='" & [销售订单] & "'") AS 序号
FROM A
或
SELECT a.单号ID, a.销售订单, (select count(*) from a as b where b.单号ID=a.单号ID and b.销售订单<=a.销售订单) AS 序号
FROM a