I see…yes, that’s happening, but in the reverse order (the controller, then the form). I was wrong about it exiting the sub. Really, I had not entered my InStr command correctly, and didn’t realize the sub was completing.
It is just some extra awkward piece of UNO API. When I translate this code into Python, the Python bridge panics at line
s1 = er.Message
because it gets an SQLError Object passed.
If I could trouble someone to look over what I have and theorize why it won’t compile, that would be great!
Sub EnteringWorkorders_InterpretErrors(e)
' msgBox "Error...Interpreting"
frm = e.Source
' msgBox frm.ImplementationName
IF frm.ImplementationName <> "org.openoffice.comp.svx.FormController" Then Exit Sub
' msgBox "This is the Controller."
er = e.Reason
ern = er.NextException
s1 = er.Message
s2 = ern.Message
If InStr(s2, "Duplicate entry") Then
MsgBox "That item has already been added to this workorder"
Else If InStr(s2, "Cannot delete or update a parent row: a foreign key constraint fails") Then
MsgBox "That item has already been received for this order. Therefore, it cannot be removed."
End If
n = com.sun.star.form.runtime.FormFeature.UndoRecordChanges '=9
frm.FormOperations.execute(n)
End Sub
When I try to compile it, I get
BASIC syntax error.
Unexpected symbol: End Sub.
ElseIf is one word.
1 Like