写段代码更新一下就可以了.
dim a
dim dblTotal as double
dim bFlag as boolean
记录集开始循环
do until rs.eof
a=spilt(配料,"+")
bFlag =false
dblTotal=0
for i=lbound(a) to ubound(a)
if nz(dlookup("单价","材料单价","材料名='" & a(i) & "'")) ="" then
update 配料核算 set 备注='核算失败,缺少***材料' 条件
bflag=true
exit for
else
dblTotal=dblTotal+cdbl(nz(dlookup("单价","材料单价","材料名='" & a(i) & "'")))
end if
next
if bflag =false then
update 配料核算 set 单价=dblTotal 条件
end if
rs.movenext
loop