dim rcs as recordset
set rcs = CurrentDb.openrecordser("your copied SQL code , you need te change the " into ' . ")
do until rcs.eof
docmd.sendobject command with the nescesary parameters, look in the help.
rcs.movenext
loop
rcs.close
set rcs= nothing