From: Martin on
Using VB6 - SP5 MS Access (MDB) data file.

I'm having problems with Error 3021 "No Current Record" error. I have
reviewed the code - every .Update statement is preceded by either a
..AddNew or a .Edit.

In an attempt to find where this is occurring, I have every instance
of data file access (seek/read - edit - addnew - update) surrounded
with a "On Error GoTo" structure which will log the error to an event
log that is already part of the program. But the program has crashed
several times (with Error 3021) since that trapping was added.

I just read KB106494 which is about this error. There is a sentence in
there that says: "The On Error statement fails to trap this error."
Huh ? Is this true?

So, I have two questions:

* does anything else besides .Update cause this error?

* is it really true that this error is not caught by On Error?



From: Jon Lewis on
Can't you just set a break point and step through the code to find out which
line of code this occurs on?

'No Current Record' errors most often occur when the recordset is empty so
it is best to always test the recordset before working with it.
For a DAO Recordset:

If Not Rst.EOF Then....

HTH

"Martin" <ironwoodcanyon(a)gmail.com> wrote in message
news:66gsp5p87is3hfngv9evg0fer91655ojmo(a)4ax.com...
> Using VB6 - SP5 MS Access (MDB) data file.
>
> I'm having problems with Error 3021 "No Current Record" error. I have
> reviewed the code - every .Update statement is preceded by either a
> .AddNew or a .Edit.
>
> In an attempt to find where this is occurring, I have every instance
> of data file access (seek/read - edit - addnew - update) surrounded
> with a "On Error GoTo" structure which will log the error to an event
> log that is already part of the program. But the program has crashed
> several times (with Error 3021) since that trapping was added.
>
> I just read KB106494 which is about this error. There is a sentence in
> there that says: "The On Error statement fails to trap this error."
> Huh ? Is this true?
>
> So, I have two questions:
>
> * does anything else besides .Update cause this error?
>
> * is it really true that this error is not caught by On Error?
>
>
>


From: Martin on
Yes, I could set a breakpoint here in my office on the development
machine but the problem is occurring only on the production version
running in a client's warehouse.

FWIW, I have reviewed and exercised this whole thing throughly in the
office. Every record-access (edit / update / etc.) is preceeded by a
..NoMatch check.

I added the error trapping to try to identify where in the program
this is happening. And, BTW, the error trapping DOES trap this error
when I force it to occur while I'm running in the VB editor.

I'm to a point where I simply can't figure out where this is occuring.




On Mon, 15 Mar 2010 15:12:43 -0000, "Jon Lewis"
<jon.lewis(a)cutthespambtinternet.com> wrote:

>Can't you just set a break point and step through the code to find out which
>line of code this occurs on?
>
>'No Current Record' errors most often occur when the recordset is empty so
>it is best to always test the recordset before working with it.
>For a DAO Recordset:
>
>If Not Rst.EOF Then....
>
>HTH
>
>"Martin" <ironwoodcanyon(a)gmail.com> wrote in message
>news:66gsp5p87is3hfngv9evg0fer91655ojmo(a)4ax.com...
>> Using VB6 - SP5 MS Access (MDB) data file.
>>
>> I'm having problems with Error 3021 "No Current Record" error. I have
>> reviewed the code - every .Update statement is preceded by either a
>> .AddNew or a .Edit.
>>
>> In an attempt to find where this is occurring, I have every instance
>> of data file access (seek/read - edit - addnew - update) surrounded
>> with a "On Error GoTo" structure which will log the error to an event
>> log that is already part of the program. But the program has crashed
>> several times (with Error 3021) since that trapping was added.
>>
>> I just read KB106494 which is about this error. There is a sentence in
>> there that says: "The On Error statement fails to trap this error."
>> Huh ? Is this true?
>>
>> So, I have two questions:
>>
>> * does anything else besides .Update cause this error?
>>
>> * is it really true that this error is not caught by On Error?
>>
>>
>>
>

From: Jon Lewis on
Replies in line:


"Martin" <ironwoodcanyon(a)gmail.com> wrote in message
news:g6ksp5h3pj33q2k80v5bkglmbmucri1l13(a)4ax.com...
> Yes, I could set a breakpoint here in my office on the development
> machine but the problem is occurring only on the production version
> running in a client's warehouse.

What about a compiled exe on your development m/c?

>
> FWIW, I have reviewed and exercised this whole thing throughly in the
> office. Every record-access (edit / update / etc.) is preceeded by a
> .NoMatch check.

..NoMatch is different to .EOF though so have you tried .EOF?

>
> I added the error trapping to try to identify where in the program
> this is happening. And, BTW, the error trapping DOES trap this error
> when I force it to occur while I'm running in the VB editor.
>

If you mean by Raising the same error number then I'm not sure that this
would be the exact same circumstances or indeed the same error and also
compile options may have a bearing on the different behaviour, others may be
able to elucidate more.

HTH


> I'm to a point where I simply can't figure out where this is occuring.
>
>
>
>
> On Mon, 15 Mar 2010 15:12:43 -0000, "Jon Lewis"
> <jon.lewis(a)cutthespambtinternet.com> wrote:
>
>>Can't you just set a break point and step through the code to find out
>>which
>>line of code this occurs on?
>>
>>'No Current Record' errors most often occur when the recordset is empty so
>>it is best to always test the recordset before working with it.
>>For a DAO Recordset:
>>
>>If Not Rst.EOF Then....
>>
>>HTH
>>
>>"Martin" <ironwoodcanyon(a)gmail.com> wrote in message
>>news:66gsp5p87is3hfngv9evg0fer91655ojmo(a)4ax.com...
>>> Using VB6 - SP5 MS Access (MDB) data file.
>>>
>>> I'm having problems with Error 3021 "No Current Record" error. I have
>>> reviewed the code - every .Update statement is preceded by either a
>>> .AddNew or a .Edit.
>>>
>>> In an attempt to find where this is occurring, I have every instance
>>> of data file access (seek/read - edit - addnew - update) surrounded
>>> with a "On Error GoTo" structure which will log the error to an event
>>> log that is already part of the program. But the program has crashed
>>> several times (with Error 3021) since that trapping was added.
>>>
>>> I just read KB106494 which is about this error. There is a sentence in
>>> there that says: "The On Error statement fails to trap this error."
>>> Huh ? Is this true?
>>>
>>> So, I have two questions:
>>>
>>> * does anything else besides .Update cause this error?
>>>
>>> * is it really true that this error is not caught by On Error?
>>>
>>>
>>>
>>
>


From: Dave O. on

"Martin" <ironwoodcanyon(a)gmail.com> wrote in message
news:g6ksp5h3pj33q2k80v5bkglmbmucri1l13(a)4ax.com...
> Yes, I could set a breakpoint here in my office on the development
> machine but the problem is occurring only on the production version
> running in a client's warehouse.

Ask the customer for a copy of their database, I would not be shocked if
they have managed to corrupt their database, perhaps they had a power outage
or the PC crashed, or maybe they have cleared a table you never expected to
be cleared.
Eliminate user error before you waste ages looking for a programming error
which may not exist.
If you do find a problem with their database, then you should modify your
program to allow for such issues.

Dave O.