Sleep and wait???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In setting a forms record source via code, I sometimes get execution errors
on subsequent lines of code that on the face of it make no sense. After
testing / debugging it occurred to me to insert a call to sleep for a short
period of time waiting for the ADP/SQL Server to fully catch up to the
request. The problem disappeared. I looked at what Profiler was doing and
there are a lot of calls being fulfilled, i.e. multiple subforms, combo box
data sources and the like. All valid.

All DB calls are via stored procedures and the problem is not limited to
just setting the Record Source. So whenever I find the problem popping up, I
plug in a call to sleep.

Granted this is a complex form but this does seems a bit silly to me. Is
there a better way to know (and / or code) when ADP/SQL Server are done and
available for further processing?
 
Not sure to understand your problem but you can try the refresh command from
the View menu for both the tables and the Views and Stored Procedures
windows in the databases window.
 
A ADODB.Command has a StillExecuting Flag

ie
While Cmd.StillExecuting
DoEvents
Wend

hth

Pieter
 
Back
Top