Originally Posted by
ssanfu
Interesting.... I have noticed that once in a while, I have to add a "DoEvents" to allow processes to complete. Most notably using Excel Automation.
So Pause (.08) is a UDF you wrote?
Have you tried using one or two DoEvents instead of Pause??
I've never used DoEvents expicitly, but the Pause function does. Not sure where I got it, but FWIW:
Code:
Public Function Pause(NumberOfSeconds As Variant) 'got this from the net
On Error GoTo Err_Pause
Dim PauseTime As Variant, start As Variant
PauseTime = NumberOfSeconds
start = Timer
Do While Timer < start + PauseTime
DoEvents
Loop
Exit_Pause:
Exit Function
Err_Pause:
MsgBox Err.Number & " - " & Err.Description, vbCritical, "Pause()"
Resume Exit_Pause
End Function
Incidentally, if I debug.print the subform's recordcount before and after the pause, it is zero before and correct after, if the Pause parameter is 0.3 or greater. At 0.2, the recordcount is still zero after the pause. (This is a very small, test recordset.) If I try a recordset object property called .StillExecuting it throws an out of context type error - not surprising, I guess, since I don't really understand how that property should be used.
What's frustrating for a hobbiest like me is I don't know if 1) I'm coding suboptimally, 2) this is a good old fashioned bug, 3) Access is built from modular components which are necessarily (for some reason) insulated from each other by "shockabsorbers" such that asynchrony between events is introduced, or 4) me.computer = gremlins.
The beat goes on. -Ron