sql="select aaa,bbb from t1 where id="&id rs.open sql,conn,1,1 if not rs.eof then sql="insert into t2 (delid,aaa,bbb) values("&id&",'"&rs("aaa")&"','"&rs("bbb")&"')" conn.execute sql end if rs.close() sql="delete from t2 where id="&id conn.execute sql