Access 2002 SP3

M

Mark

IT Pro's,
I installed SP3 on the office suite and found that the
standard code to delete a record generates an error
message. When one is on the last record of a form, and
uses the DoMenuItem cmd, a 3021 runtime error is
generated. If one is not on the last record but
answers "No" to the message box "You are about to delete
1 record" the same error gets generated.
The code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, ,
acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, ,
acMenuVer70

The last line fails with a "No current record" error.
This is only happened after the installation of Service
Pack 3. Does anyone have any suggestions of why or can
offer a strategy for a solution?
Thanks for any help,
Mark Miller
(e-mail address removed)
 
A

Allen Browne

Hi Mark. This is a known flaw in A2002 SP3.

The workaround is to use error handling in the event, and just ignore it if
Err.Number = 3021.

AFAIK, there are no other side effects of this error. Access seems to
recover and sort itself out shortly after AfterDelConfirm.

Post back if you need help to create an error handler in the routine.
 
G

Guest

Allen,
Thanks for the response. My question then is about error
handling. If I use a utility function in a module that
deletes records, and I call this function from other
functions, the code stops at the error. See example
below, this is the last part of the delete utility
function:

DeleteTheRecordGranted:
Beep
If MsgBox("C A U T I O N !" & vbCrLf & vbCrLf & "You
are about to DELETE, " & vbCrLf & vbCrLf &
DeletionMessage & "?", vbYesNo, SystemTitleShip) = vbYes
Then
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, ,
acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, ,
acMenuVer70
Call LogTheActivity("Deleted " & DeletionMessage)
End If

DeleteTheRecordExit:
Exit Function

DeleteTheRecordError:
If Err() = 3021 Then Resume

Call ProcessTheFunctionError(Error$, Err)
Resume DeleteTheRecordExit

End Function

With this function the call to "LogTheActivity" will
never run. If I call this from inside another procedure,
everything after the call will not run.
Is there any way to handle the error and still have the
function continue?
Thanks for your help,
Mark
 
A

Allen Browne

Resume causes it to resume at the line which caused the error.

You probably want:
If Err.Number = 3021 Then
Resume Next
Else
Call ProcessTheFunctionError(Error$, Err)
Resume DeleteTheRecordExit
End If
or possibly:
If Err.Number <> 3021 Then
Call ProcessTheFunctionError(Error$, Err)
End If
Resume DeleteTheRecordExit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top