O
otterbyte
I have two recordsets which are looping one inside the other. The
'inner', small recordset is based on a simple select query and opened
as dbOpenForwardOnly. As it loops, it updates values (using DAO) in the
outer recordset. The outer recordset has almost 200k records, but the
inner one will only have 3 to 7 records. My problem is this: just after
the last record of the inner recordset has processed, once the inner
recordset is at the EOF, it takes forever to process the .MoveNext
statement. This is the only line that slows down. Considering the outer
recordset has so many records, I can't wait for a 20-30 second hang on
each one. What could be happening? I have tried changing the options on
the inner recordset to dbOpenSnapshot and even leaving the defaults,
with no change. I tried changing from 'Do Until .EOF' to 'Do While Not
..EOF' with no change in speed. I've checked the newsgroups and I found
one post that mentions this same problem, but it's from 1996 and there
were no replies. Here is the skeleton of my code:
************
With rstOuter
Do Until .EOF
Set rstInner= db.OpenRecordset("SELECT * FROM tblTable " & _
"WHERE Field1= '" & !Field1 & "'", dbOpenForwardOnly)
.Edit
Do While Not rstInner.EOF
rstOuter!Field2 = rstInner!Field2
rstOuter!Field3 = rstInner!Field3
rstInner.MoveNext '<--hangs on the final iteration of the
loop
Loop
rstInner.Close
.Update
.MoveNext
Loop
.Close
End With
*************
I am using DAO 3.6 and Access 2k. Any clues on what I might be doing
wrong? And what the heck I can do to make it better?
TIA,
Erika
'inner', small recordset is based on a simple select query and opened
as dbOpenForwardOnly. As it loops, it updates values (using DAO) in the
outer recordset. The outer recordset has almost 200k records, but the
inner one will only have 3 to 7 records. My problem is this: just after
the last record of the inner recordset has processed, once the inner
recordset is at the EOF, it takes forever to process the .MoveNext
statement. This is the only line that slows down. Considering the outer
recordset has so many records, I can't wait for a 20-30 second hang on
each one. What could be happening? I have tried changing the options on
the inner recordset to dbOpenSnapshot and even leaving the defaults,
with no change. I tried changing from 'Do Until .EOF' to 'Do While Not
..EOF' with no change in speed. I've checked the newsgroups and I found
one post that mentions this same problem, but it's from 1996 and there
were no replies. Here is the skeleton of my code:
************
With rstOuter
Do Until .EOF
Set rstInner= db.OpenRecordset("SELECT * FROM tblTable " & _
"WHERE Field1= '" & !Field1 & "'", dbOpenForwardOnly)
.Edit
Do While Not rstInner.EOF
rstOuter!Field2 = rstInner!Field2
rstOuter!Field3 = rstInner!Field3
rstInner.MoveNext '<--hangs on the final iteration of the
loop
Loop
rstInner.Close
.Update
.MoveNext
Loop
.Close
End With
*************
I am using DAO 3.6 and Access 2k. Any clues on what I might be doing
wrong? And what the heck I can do to make it better?
TIA,
Erika