Sounds simple but seems to be complicated.
I have a nice base form with two tables a addesses and a filter table.
On the addresses layer I have a button that triggers a macro. That works.
But how can I now insert in the active field of my address tabel in a form insert a timestamp.
Thanks for any hint!
set → timestamp into → active → LETZTER KONTAKT
so far it is not working with 1. Answer so I will add some more information:
Libre Version: 126.96.36.199
internal database HSQLDB embedded
the base database is called: Kontakte.odb
Table called: Adressen
Field called: KONTAKT_ZEIT (Date/Time[TIMESTAMP])
Form called: F_Adressen
Form has on main level: the “Filter” Table
Form has as sub of Filter the: “Adressen” Table
The “set” Button is part of the “Adressen” Layer as is the target field “Adressen->KONTAKT_ZEIT”
Filter and filtering works as described in the manual with a assistance table to give the filter values.
The insert-timestamp-macro is under:
Kontakte.odb->Standard->_ insertTimestamp → DtTime
it shows also under:
My Macros & Dialogs → Standard → _ Module1 → DtTime
The “set” button on the form “F_Adressen” is next to the field “KONTAKT_ZEIT” that is part of the filter results (Adressen as sub of filter, all on Form) → the button has in the Events:
“Key pressed”: Standard.insertTimestamp.DtTime(document, Basic)
This is the macro now:
Option Explicit Sub DtTime Dim oForm As Object Dim oDocCtl As Object Dim oField As Object Dim oCtlView As Object Dim oBoundField As Object oForm =ThisComponent.Drawpage.Forms.getByName("F_Adressen") Dim aTD As New com.sun.star.util.DateTime oField = oForm.getByName("KONTAKT_ZEIT") aTD.Day = DAY(Now()) aTD.Month = MONTH(Now()) aTD.Year = YEAR(Now()) aTD.Hours = HOUR(Now()) aTD.Minutes = MINUTE(Now()) aTD.Seconds = SECOND(Now()) oBoundField = oField.BoundField oBoundField.updateTimestamp(aTD) End Sub
The database file with only two data-sets: