Re: Waiting for a recordset to finish fetching
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Thu, 26 Jul 2007 11:23:14 -0400
JoelB wrote:
I have one form kicking off another, and passing a record ID to the
latter as a parameter. The popup in turn makes a clone of its own
recordset, and then does a find on the clone using bookmarks to move
the user to the desired record. Pretty standard stuff.
Well, sometimes users are complaining that it's not finding the
record.
What I think is happening is that it is that the find is executing
before all of the records are retrieved from the database. To prove
it, I logged debug messages using the recordset.state property, and
sure enough, the times it failed, the state was 9 and the times it
did not fail the state was 1.
So, I added this code, right before the find:
Do While rs.State <> adStateOpen
' (nothing)
Loop
However, within the loop, the state never changes. I actually
included a timer to prevent an endless loop, and when I add a
debug.print inside the loop, even when I set it for 15 seconds it
still stays in the fetching state (9) for the full period. I guess
the fetch is stalled while loop is running.
Can anyone suggest an alternate way to wait until the recordset is
built before doing the find?
The platform is MS Access.
TIA,
Joel
Are you using a single connection?
Unless you are using an asynchronous connection, you should not be running
into this problem, unless you are using a single connection to try and open
a recordset while the connection is still dealing with another recordset.
You can avoid this by using a client-side recordset and disconnecting it by
setting its ActiveConnection property to Nothing, leaving the connection
free to deal with a new recordset.
It doesn't sound like it but you may be running into the Jet dalayed-write
optimization:
single connection:
http://support.microsoft.com/?kbid=240317
two connections:
http://support.microsoft.com/kb/200300
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- Follow-Ups:
- Re: Waiting for a recordset to finish fetching
- From: JoelB
- Re: Waiting for a recordset to finish fetching
- Prev by Date: Re: Which ADO provider to use to connect to MS Access DB under Vista x64 ?
- Next by Date: Re: Waiting for a recordset to finish fetching
- Previous by thread: How to protect data within MS access?
- Next by thread: Re: Waiting for a recordset to finish fetching
- Index(es):
Relevant Pages
|
|