You may have come across this but just in case...
I have had several instances recently where a Recordset.MoveLast did not complete before the next program code line was executed (seems to be slightly asynchronous). This only occurs on very large DAO recordsets and had the mild effect of breaking some progress bars.
Typical code fragment
Set workrs = workdb.OpenRecordset(someSQL)
If Not workrs.BOF then
workrs.MoveLast
Progressbar1.Value = 0
Progressbar1.Max = workrs.RecordCount
Progressbar1.Visible = True
WorkRs.MoveFirst
End If
Do Until workrs.EOF
Progressbar1.Value = Progressbar1.Value + 1
'do some stuff
workrs.MoveNext
Loop
|
Would sometimes have the progress bar report an error when it's value
exceeded the Max property.
The fix was quite simple - insert a DoEvents after the MoveLast (although
that could have GUI implications).
Not terribly serious but I have now tied down an instance where MoveFirst
has also failed to complete properly with a large recordset. This was more
of a problem for me.
Code fragment:
Do Until workrs.EOF
'do the initial stuff
workrs.MoveNext
Loop
workrs.MoveFirst
Do Until WorkRs.EOF
'do some more stuff
WorkRs.MoveNext
Loop
|
Failed to process one of the records in the recordset the second time
around. The first thing happened but the second did not so I can be sure the
record was in the recordset.
I will be trying out a DoEvents after the MoveFirst in this case as well.
All this may, of course, only be a feature when running programs from the
IDE as each instance I can put my finger on has occurred in that
circumstance - but of course I have applied the remedy before creating a
final executable so who knows?