1、写一个自定义函数:
function valUpdate()
dim rs as new adodb.recordset
dim rs0 as new adodb.recordset
dim i as long,j as long
rs.Open "你的数据表名称", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs0.Open "你的临时数据表名称", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
if rs0.recordcount>0 then
for i=1 to rs0.recordcount
rs0.delect
rs0.update
next
end if
for i=1 to rs.recordcount
fro j=0 to rs.fileds.count-1
if rs.filds(j).name="数据1" or rs.filds(j).name="数据2" or rs.filds(j).name="数据3" then
if nz(rs.filds(j).value,0)<>0 then
rs0.addnew
rs0("临时表中的字段名称").value=rs.filds(j).value
rs0.update
end if
end if
next
rs.movenext
next
rs.close:set rs=noting
rs0.close:set rs0=nothing
end function