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 form_error is
not triggered.
¿any ideas?
help will be appreciated
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 form_error is
not triggered.
¿any ideas?
help will be appreciated