subform does not trap error

R

robeito

Hello everybody:

I have a subform with this code:

Private Sub Form_Error(DataErr As Integer, Response As Integer)
Select Case DataErr
Case 3022
Call MsgBox("This institución already exist, " & vbCrLf
& "duplicates are not allowed", vbCritical, "Información")
Response = acDataErrContinue
Case 3200
Call MsgBox("the record can not be deleted because"
& vbCrLf & "the institución is referenced by other document",
vbInformation, "Información")
Response = acDataErrContinue
Case Else
Call MsgBox(DataErr, vbCritical, "Error del sistema")
End Select
End Sub

In run time, the subform works fine:
Capturing duplicated text raises an error of duplicated index and the
adequate message is shown.
Trying to delete a record referenced in another table breaks the relation
and the error is trapped.

The problem arises when the subform is embedded in a main form:
I have a command button called btnDeleteRecord with this code in the main
form:
Private Sub btnDeleteRecord_Click()
Me.sfrm1.SetFocus
RunCommand acCmdDeleteRecord
End Sub

Using this button erases records correctly, but in case of records
referenced in other tables, error trapping is not done. Even the form_error
event is not triggered.

But, duplicated index error trapping still is working fine.

¿any ideas?

help will be appreciated
 

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

Similar Threads


Top