We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

Ardee's profile - activity

2021-06-11 16:36:00 +0200 received badge  Notable Question (source)
2020-12-11 12:51:54 +0200 received badge  Famous Question (source)
2020-09-03 23:48:01 +0200 received badge  Notable Question (source)
2020-09-03 20:49:58 +0200 received badge  Famous Question (source)
2020-07-07 01:31:49 +0200 received badge  Famous Question (source)
2020-07-05 19:42:09 +0200 received badge  Popular Question (source)
2020-04-28 01:35:07 +0200 commented answer Template and Default Directory

Thanks @uglybug for "'the frugal computer guy" suggestion, that is indeed a good source, I have already seen several of

2020-04-28 01:13:09 +0200 commented answer Template and Default Directory

Hi @uglybug, as a further note, in design mode I discovered you can enter a default directory in the "graphics" tab, th

2020-04-28 00:53:38 +0200 commented answer Template and Default Directory

Thanks @uglybug for your comments. I fear we are not on the same wavelength, I must be doing a poor job of explaining my

2020-04-27 18:10:36 +0200 received badge  Famous Question (source)
2020-04-27 01:03:29 +0200 commented answer Template and Default Directory

Sorry @uglybug, I seem to have a problem being clear about the issue, I edited to summarise hopefully more concisely wha

2020-04-27 01:01:37 +0200 commented answer Template and Default Directory

Sorry I seem to have a problem being clear about the issue, I edited to summarise hopefully more concisely what problem

2020-04-27 01:00:16 +0200 commented answer Template and Default Directory

Sorry I seem to have a problem being clear about the issue, I edited to summarise hopefully more concisely what problem

2020-04-26 23:10:25 +0200 edited question Template and Default Directory

Template and Default Directory My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQLDB Version 2.3.2 Split

2020-04-26 23:08:37 +0200 edited question Template and Default Directory

Template and Default Directory My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQLDB Version 2.3.2 Split

2020-04-26 20:52:12 +0200 commented answer Template and Default Directory

Thank you @Ratslinger for your usual frankness. I take it I expressed myself very badly, sorry to hear you have no inter

2020-04-26 19:45:35 +0200 received badge  Notable Question (source)
2020-04-26 18:20:11 +0200 commented answer Template and Default Directory

Thanks @uglybug, the imagecontrol I'm talking about is on a database form, to update images in the database. Thank you f

2020-04-26 12:01:44 +0200 received badge  Popular Question (source)
2020-04-26 11:26:00 +0200 commented question Template and Default Directory

Hi there @Uglybug thank you for your suggestion, yes that works and I can set the url via a macro so that it works for d

2020-04-26 01:59:54 +0200 asked a question Template and Default Directory

Template and Default Directory My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQLDB Version 2.3.2 Split

2020-04-23 00:26:27 +0200 commented answer Macro to update "data source" property on the Writer form of a template

@Ratslinger many thanks, that worked fine. Your pic inspires to get MRI, I know you recommended this extension earlier,

2020-04-23 00:07:34 +0200 marked best answer Macro to update "data source" property on the Writer form of a template

My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQLDB Version 2.3.2 Split Database

On the "When Loading" event of a writer template, I pick up the template's location with thisComponent.url from which I can diagnose the location and name of the database I need to reference on the form's "data source" property.

Browsing through documentation I could not find the syntax to place that diagnosed value to the form's "data source" property.

Can someone help please? Thank you

2020-04-22 22:41:54 +0200 received badge  Popular Question (source)
2020-04-18 23:08:18 +0200 marked best answer Writer Macro to collect and insert data from Base Query

My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQLDB Version 2.3.2 Split Database

Is it possible for a macro launched on opening a writer template to insert some textfields from a specific base query?

Could anyone suggest code or guide me to documentation or an example please. Thank you

2020-04-18 19:56:53 +0200 received badge  Notable Question (source)
2020-04-18 14:17:28 +0200 commented answer Writer Macro to collect and insert data from Base Query

@Ratslinger, many thanks for responding. The magic words to help me wade through documentation were "master text fields"

2020-04-18 14:14:50 +0200 commented answer Writer Macro to collect and insert data from Base Query

@Ratslinger, many thanks for responding. The magic words to help me wade through documentation were "master text fields"

2020-04-18 01:27:14 +0200 edited question Writer Macro to collect and insert data from Base Query

Writer Macro to collect and insert data from Base Query My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) H

2020-04-18 01:22:15 +0200 received badge  Popular Question (source)
2020-04-14 01:37:47 +0200 marked best answer How to Edit HelpText Property of a Control by Macro

My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQLDB Version 2.3.2 Split Database

I am busy developing a macro to iterate through a form and change any HelpText property content to another language (depending on user preference).

What code would allow me to edit the HelpText property of a Control to a new text? This is the only thing for which I seek help, the syntax to access the HelpText Control for edit.

This is the code I use to obtain the HelpText content of a given Control

Sub GetHelpText
    Dim oForm As Object
    Dim oField As Object
    Dim sGetValue As String
        oForm = ThisComponent.Drawpage.Forms.getByName("MainForm")
        oField = oForm.getByName("ButtonFileIt")
        sGetValue = oField.HelpText
        MsgBox(sGetValue)
End Sub

Thank you for any help

2020-04-14 00:53:46 +0200 received badge  Famous Question (source)
2020-04-13 22:24:19 +0200 edited question Add Default Record to SubForm For New Record MainForm

Add Default Record to SubForm For New Record MainForm My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQ

2020-04-13 22:22:06 +0200 edited question Add Default Record to SubForm For New Record MainForm

Add Default Record to SubForm For New Record MainForm My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQ

2020-04-13 19:05:48 +0200 edited question Add Default Record to SubForm For New Record MainForm

Add Default Record to SubForm For New Record Main Form My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HS

2020-04-13 19:04:08 +0200 edited question Add Default Record to SubForm For New Record MainForm

Base Macro Get ID of newly created record in a table My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQL

2020-04-13 19:03:13 +0200 edited question Add Default Record to SubForm For New Record MainForm

Base Macro Get ID of newly created record in a table My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQL

2020-04-13 03:12:22 +0200 edited question Add Default Record to SubForm For New Record MainForm

Base Macro Get ID of newly created record in a table My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQL

2020-04-13 02:22:15 +0200 edited question Add Default Record to SubForm For New Record MainForm

Base Macro Get ID of newly created record in a table My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQL

2020-04-13 02:19:13 +0200 edited question Add Default Record to SubForm For New Record MainForm

Base Macro Get ID of newly created record in a table My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQL

2020-04-13 02:04:33 +0200 edited question Add Default Record to SubForm For New Record MainForm

Base Macro Get ID of newly created record in a table My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQL

2020-04-12 13:17:10 +0200 edited question Add Default Record to SubForm For New Record MainForm

Base Macro Get ID of newly created record in a table My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQL

2020-04-12 13:14:57 +0200 marked best answer Add Default Record to SubForm For New Record MainForm

My environment: Windows 10, LibreOffice Version: 6.4.2.2 (x64) HSQLDB Version 2.3.2 Split Database

A Main Table has a sub Table in a one-to-many relationship. My objective is to force add a default record in the sub Table when a new record is added to the Main Table. I would like to do this with a macro triggered by the update event in the main table.

I'm stuck on finding the appropriate code and event trigger to get the ID (a text ID primary key) of the newly created record in a variable, I can handle the rest of the code from there. Thank you for any help.

EDIT: More Info

I tried Sub AddNewRecord on Before Updating of the Control and Sub AfterAddRecord on After Updating of Control, nothing happens (No MsgBox).

I tried Sub AddNewRecord on Before Record Change of the Form and Sub AfterAddRecord of the Form, this triggers the MsgBox with Null on opening, a value on clicking on any record, and a Null MsgBox after adding a new record.

Maybe fatigue has reduced me to not seeing the obvious.

EDIT 2020-04-13: Solved

For those interested here is the final working code (the ID to add as new record is called "TextRef"):

One could consider adding a lookup routine on the When Loading event of the form to check if there are any default records (ones with content "unspecified") in the subtable and if so provide a MessageBox alert naming the record that needs attention.

 Global sGlobalAftRecChange As String
Sub MacroAfterRecordChange
    REM this is attached to the forms --After Record Change-- event
    Dim oForm As Object
    Dim oField As Object
        sGlobalAftRecChange = ""
        oForm = ThisComponent.Drawpage.Forms.getByName("MainForm")
        oField = oForm.getByName("TextRef")
        sFieldData  = oField.Text
        If sFieldData = "" Then
        sGlobalAftRecChange = "NewRecord"
        End If
End Sub

Global sGlobalHold As String
Sub MacroBeforeRecordAction
    REM this is attached to the forms --Before Record Action-- event
    Dim oForm As Object
    Dim oField As Object
        sGlobalHold = ""
        oForm = ThisComponent.Drawpage.Forms.getByName("MainForm")
        oField = oForm.getByName("TextRef")
        sGlobalHold = oField.Text
End Sub

Sub MacroAfterRecordAction
    REM this is attached to the forms --After Record Action-- event
    REM Add default language records for a new TextRef
    Dim oForm As Object
    Dim sTextRef As String
    Dim sNewText As String
    Dim sSelect As String
            If sGlobalHold = "" Then
            Exit Sub
            End If
        If sGlobalAftRecChange = "NewRecord" Then
        sTextRef = sGlobalHold
        sNewText = "Unspecified"
        iCounter = 1
        Do While (iCounter < 7)
            sSQL = "INSERT INTO ""Text Fields Basic Details"" (""TextRef"",""Lingo"",""Text"") VALUES ('" & sTextRef & "','" & iCounter & "','" & sNewText & "')"
        RunSomeSQL (sSQL)
        iCounter = iCounter + 1
        Loop
        End If
End Sub

    Sub RunSomeSQL (sSqlTask As String)
        Dim oStatement As Object
              If IsNull(ThisDatabaseDocument.CurrentController.ActiveConnection) then
              ThisDatabaseDocument.CurrentController.connect
              End If
              oStatement = ThisDatabaseDocument.CurrentController.ActiveConnection.createStatement()
              On Error GoTo ErrorSituation
              oStatement.execute(sSqlTask)
              Exit Sub
              ErrorSituation:
              MsgBox("Invalid Sql= " & Chr$(13) & Chr$(13) &  sSqlTask)
    End Sub