D
Dhonan
I have a table that I need to access multiple times seaching for a new
primary key each time. The only was I have been able to figure out to do
this is to continually open and close the table. This seems to me to be
incredibly inefficient and clugy. Is there a better way?. Example:
Dim rs1 as new adodb.recordset
Dim rs2 as new adodb.recordset
sql="Select * from table1"
rs1.Open SQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
do until rs1.eof
SQL="select * from table2 where key1=" & rs1("keyA")
rs2.Open SQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
if not rs2.eof then
Do stuff to rs1 based on the data in rs2
end if
close.rs2
rs1.movenext
Loop
primary key each time. The only was I have been able to figure out to do
this is to continually open and close the table. This seems to me to be
incredibly inefficient and clugy. Is there a better way?. Example:
Dim rs1 as new adodb.recordset
Dim rs2 as new adodb.recordset
sql="Select * from table1"
rs1.Open SQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
do until rs1.eof
SQL="select * from table2 where key1=" & rs1("keyA")
rs2.Open SQL, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
if not rs2.eof then
Do stuff to rs1 based on the data in rs2
end if
close.rs2
rs1.movenext
Loop