2 tables in one-to-many relationship, tblOrders and tblOrdersDetails. Relationship option for Deletion is Delete cascade.
2 forms for each table with Table Controls, created with wizard
Option Explicit
Dim oDialog As Object
Sub OfferDelete(Event As Object)
Dim oForm As Object
Dim oLib As Object
Dim oLibDlg As Object
DialogLibraries.loadLibrary("Standard")
oLib = DialogLibraries.getByName("Standard")
oLibDlg = oLib.getByName("dlgCheckDelete")
oDialog = CreateUnoDialog(oLibDlg)
oForm = Event.Source.Model.Parent
' this is a Dialog for double-checking the deleting action
If oDialog.Execute() = com.sun.star.ui.dialogs.ExecutableDialogResults.OK Then
oForm.deleteRow
oForm.reload
End If
End Sub
MainForm has the Data properties:
- Allow additions – No
- Allow modifications – No
- Allow deletions – No
oForm.deleteRow
give me the “Result set is read only” Error
If I set in GUI
- Allow deletions – Yes
everything is OK
But if I add oForm.AllowDeletes = True
while in GUI is
- Allow deletions – No
again, same error.
oForm.AllowDeletes = True
oForm.deleteRow
oForm.reload
Although, if I only run step-by-step until this inclusive
oForm.AllowDeletes = True
and checking in GUI, the setting becomes
- Allow deletions – Yes
So, why manual setting in GUI is OK, but programmatically (with same result in GUI) is not OK? And how I could solve it? The solution “use the GUI” is a no-solution, It’s mandatory for final user to double-check with the Dialog
Adding the offers with SQL works OK, I assume that the updating and deleting does, but I would like the deletion to be a simple, reusable procedure, because I need it in many places and it is basically dependent only on the Form and cursor position.
I tried Wait 1000 or Wait 2000
oForm.AllowDeletes = True
Wait 1000
oForm.deleteRow
but no success.
Version: 24.2.2.2 (X86_64) / LibreOffice Community
Build ID: d56cc158d8a96260b836f100ef4b4ef25d6f1a01
Processor Intel(R) Core™ i3-9100 CPU @ 3.60GHz 3.60 GHz
Installed RAM 16,0 GB (15,8 GB usable)
System type 64-bit operating system, x64-based processor
Edition Windows 11 Pro
Version 22H2
OS build 22621.3527
Experience Windows Feature Experience Pack 1000.22700.1003.0