[Solved] Help preventing deletion in a table or form via Tri

Creating tables and queries

[Solved] Help preventing deletion in a table or form via Tri

Postby gkick » Sat May 23, 2020 8:37 am

Hi,

Is it possible to use a BEFORE DELETE Trigger in an HSQL2.5 backend based on a particular criteria and display a messagebox that this record can not be deleted and leaving the record(s) in place?

Example ... any invoice where payment > 0 can not be deleted

Thanks
Last edited by gkick on Sun May 24, 2020 4:29 am, edited 2 times in total.
Libre Office 6.2 on Windows 10 HSQL 2.5 backend
gkick
 
Posts: 250
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile

Re: Help with preventing deletion in a table or form via Tri

Postby Villeroy » Sat May 23, 2020 9:13 am

Referencial integrity does that by default. Having a 1-n relation between a table of payments (n) and a table of invoices (1) you can not delete any invoice having an entry in the payments table.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28434
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Help with preventing deletion in a table or form via Tri

Postby Sliderule » Sat May 23, 2020 3:01 pm

gkick wrote:Is it possible to use a BEFORE DELETE Trigger in an HSQL2.5 backend based on a particular criteria and display a messagebox that this record can not be deleted and leaving the record(s) in place?

Example ... any invoice where payment > 0 can not be deleted

Yes.
User avatar
Sliderule
Volunteer
 
Posts: 1241
Joined: Thu Nov 29, 2007 9:46 am

Re: Help with preventing deletion in a table or form via Tri

Postby gkick » Sat May 23, 2020 5:34 pm

Thanks gentlemen!
Libre Office 6.2 on Windows 10 HSQL 2.5 backend
gkick
 
Posts: 250
Joined: Wed Aug 07, 2019 5:24 pm
Location: Chile


Return to Tables & Queries

Who is online

Users browsing this forum: No registered users and 0 guests