B
Brett Steele
We have an application that uses the following code:
Dim rstClone As Recordset
Set rstClone = Me.RecordsetClone
Dim strClone As String
strClone = "ListDescription = '" & Trim(UCase(strvarListDescription)) & "'"
rstClone.Find strClone
If rstClone.EOF Then
DoCmd.CancelEvent
Exit Sub
Else
Me.Bookmark = rstClone.Bookmark
End If
rstClone.Close
What we are seeing is that if we let this code run, it never finds a match,
even though the match exists. If we put the following code in to pause the
execution of the code:
'WE put this timer here because code was executing too fast.
'This slows the code down so SQL has enough time run it
squery
Finish = 900
PauseTime = 3 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.
the find always finds a match. What this indicates to us is that the entire
recordset is not built with the Set rstClone = Me.RecordsetClone command and
the Find executes before the recordset is actually completed. Does this
make sense to anyone? We have other areas where we use exactly the same
logic and have never had a problem. We have even tried going to the end of
the recordset before issuing the find and that doesn't work either.
Thanks in advance.
Dim rstClone As Recordset
Set rstClone = Me.RecordsetClone
Dim strClone As String
strClone = "ListDescription = '" & Trim(UCase(strvarListDescription)) & "'"
rstClone.Find strClone
If rstClone.EOF Then
DoCmd.CancelEvent
Exit Sub
Else
Me.Bookmark = rstClone.Bookmark
End If
rstClone.Close
What we are seeing is that if we let this code run, it never finds a match,
even though the match exists. If we put the following code in to pause the
execution of the code:
'WE put this timer here because code was executing too fast.
'This slows the code down so SQL has enough time run it
squery
Finish = 900
PauseTime = 3 ' Set duration.
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
Finish = Timer ' Set end time.
TotalTime = Finish - Start ' Calculate total time.
the find always finds a match. What this indicates to us is that the entire
recordset is not built with the Set rstClone = Me.RecordsetClone command and
the Find executes before the recordset is actually completed. Does this
make sense to anyone? We have other areas where we use exactly the same
logic and have never had a problem. We have even tried going to the end of
the recordset before issuing the find and that doesn't work either.
Thanks in advance.