
MS Access & ADO - Recordset needs reset
If I open a recordset to be used in a for-next loop, I have to set the
recordset variable to nothing and recreate it for each loop because setting
the parameters won't change the parameter values after the execution of the
command.
This is only true for Access DB, works great for SQL Server and Oracle
without closing and reopening all the time.
Any ideas here?
pseudo code snip:
dim qd as adodb.command
dim rs as adodb.recordset
set rs = cn.execute("open invoice item table")
do until rs.eof
if usingaccess then
set qd = nothing
set qd = (open the command)
else (sql server and oracle)
open the command if it's not already open
end if
with qd
.parameters(0) = something
.parameters(1) = something else
.execute
end with
rs.movenext
loop
NT or 98 or 95
Access 97
ADO 2.1