LibreOffice Basic Open Form with Macro

The macro

Sub Dialog1Show
' References include

    thisDoc = StarDesktop.CurrentComponent
    'MsgBox thisDoc.dbg_properties
    'MsgBox thisDoc.dbg_methods
    thisForm = thisDoc.getdrawpage.getbyindex(2)
    thisID = thisForm.getControl.Text
    'MsgBox "using ID " & thisID

    form_container = ThisDatabaseDocument.FormDocuments.getByName("EditContact")
    form2 = form_container.component.getDrawPage.getforms.getbyindex(0)
    form2.Filter =("ID = " & thisID)
End Sub


The story

In my migration to Linux on the desktop (yes, this is the year for me), I have started converting my Microsoft Access .accdb file to LibreOffice. In my interim I had a really cool jdbc connection, but now was the time to actually get off of that entirely.

Using some instructions for the overly-simple task of exporting and importing data into LibreOffice Base, I got my little table saved to a .ods and then imported into a new, HyperSQL database.

Oh my goodness, HyperSQL is not what I learned in my few database classes during college. I had to rewrite my mid-level-complexity query (the first time for the jdbc connection, and then again) for HyperSQL. Some user-unfriendly documentation exists.

In the function above, the MsgBox contents are debugging info that can provide you with method calls to duckduckgo to get examples and descriptions.

In a future post I might share my “ContactsExtended” query I wrote a long time ago in Access 2010 and have ported up all the way to my current HyperSQL format.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.