You are right: You will need macros.
First step: Create the body for a procedure called “Copy”
-
Start Tools → Macros → Organize Macros → Basic
-
Click in Macro from
on you database file. Then click on New
. Name for new module will be Module 1 → OK
.
-
Editor opens with Sub Main
, an empty row and End Sub
-
Change “Main” to “Copy(oEvent AS OBJECT)”
Now you have created a procedure and could start creating the content.
Checkbox is created in the form. You have to know the names of the fields for T, U and V in the form.
SUB Copy(oEvent AS OBJECT)
oField = oEvent.Source.Model
oForm = oField.Parent
oField1 = oForm.getByName("txtA")
oField2 = oForm.getByName("txtB")
oField3 = oForm.getByName("txtC")
oField4 = oForm.getByName("txtD")
oField5 = oForm.getByName("txtE")
oField6 = oForm.getByName("txtF")
IF oField.State = 1 THEN
oField4.BoundField.UpdateString(oField1.CurrentValue)
oField5.BoundField.UpdateString(oField2.CurrentValue)
oField6.BoundField.UpdateString(oField3.CurrentValue)
END IF
END SUB
Might be the fields aren’t fields for a string. If it doesn’t work we should change it to needed type.
This macro should now be started by the check box.
Open the form for editing, not for input data.
Mark the check box. If it doesn’t exist create it. Right mouse click on the box and Control Properties → Events → Item Status Changed
. Click on the button with the three points and such for procedure “Copy”.
That’s it. If you haven’t used macros before you have to switch Tools → Options → LibreOffice → Security → Macro Security
. Press the button and change the security in the dialog to “Medium”. I have set a special path here as “Trusted Source”, so I’m only asked for executing macros, if the file isn’t saved in this path.