SELECT P产品5明细表.产品ID AS 编号, Max([SS-销售价格扩展查询].实施日期) AS 实施日期, Last([SS-销售价格扩展查询].吨价) AS 吨价
FROM [SS-销售价格扩展查询] INNER JOIN P产品5明细表 ON [SS-销售价格扩展查询].产品编号 = P产品5明细表.产品ID
GROUP BY P产品5明细表.产品ID;
然后改VBA如下:
Private Sub 产品编号_AfterUpdate()
If IsNull([产品编号]) Then Exit Sub
Me.单价 = DLookup("吨价", "SS-最新价格查询L", "编号=" & Me.产品编号) / 1000
End Sub