LO 7.4 Linux Mint 20 jdbc:MySql 8
I have a Form that requires some information filled in at the top of the Form so it can run a SQL Query to auto fill in information at the bottom of the form. Specifically, it needs the record’s ID which I set in a table column called ‘id’ (autofield, primary key). I need code that will save the record. After searching here I found the following code that was recommended in FirebirdCloseSaveMacro. I used that code as follows but it does nothing and doesn’t throw an error when I call the sub in the form. If I fill in the required fields first then click on the Save icon in Navigator Control everything gets filled in properly, so the rest of my form code is working, just need to force a record save to automate.
I have tried uno:Save, uno:RecSave and tried adding uno:Refresh and uno:RecRefresh, no joy.
Sub SaveRecord
    Dim dispatcher
    Dim oForm As Object
    Dim oDocument As Object
    Dim oParent As Object
    oForm  = ThisComponent.DrawPage.getForms().getByName("MainForm")
    oDocument = ThisComponent.Parent.CurrentController.Frame
    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
    dim args1(0) as new com.sun.star.beans.PropertyValue
    args1(0).Value = 0
    dispatcher.executeDispatch(oDocument, ".uno:Save", "", 0, args1())
    'dispatcher.executeDispatch(oDocument, ".uno:Refresh", "", 0, args1())
End Sub
