Delete record only if the record isn't related which other record in specific module

Goodmorning,
is there the possibility to prevent record deleted if this record is related with one or more records of a particular module?
In my case, I have account with a relationship with myModule. In account detail there is a subpanel for myModule.
I would like permit to delete an account only if this account isn’t related with any record of myModule.
is this possible?
Thank you,
B.

@bf.ts90
Hi,
You can use logichook before_delete. Look at a documentation.

Thank you for your reply. Is there the possibility, from logic hook, to show an alert with error if it is not possible delete the record?

@bf.ts90

Logichooks work with data of the record. You can create special field as a switch for showing message. The message can be show in list, detail, edit view. Look at the post for more information.