How to avoid sql error on leaving subform

Win10 LO 7.3.7.3 HSQL 2.61

Hello,

Not sure to handle this issue. , Have a mainform with multiple subforms one of which facilitates the entry of new rental bookings

The form also sports an Undo button in case the new booking is cancelled before being created.

All working fine, however if clicking outside the newbooking subform the following error occurs.

Now since this is a sql complaint I am not sure if a star basic errorhandler could run something like what the Undo button does. Here is the code which runs on clicking the New Booking button.

Looking forward to ideas, suggestions how to tackle this. Thank you for your time.

Hello,
.
Whenever moving to a different section you exit an internal form or sub form (etc), even if the item left was not completed, an attempt will be made to write the record.
.
In your case, it appears (lack of some information) you have a field in the sub form (? - not very clear) that cannot be NULL (empty) - check. This kind of makes sense as it appears this is noted as a Cash item.
.
So this is not an sql complaint as noted but rather a restriction you have placed upon that field. You do not need some error handler but more likely to remove the field restriction in the table. It is a field property of Entry required.

Thank you, yes, the culprit is an index on a field being part of a multiple field primary key.