Ask Your Question

Where does the OpenOffice Database name come from.

asked 2021-04-28 04:53:17 +0200

Shaba1 gravatar image

updated 2021-04-28 05:20:32 +0200

Ratslinger gravatar image

I am working on a Windows 10 LibreOffice 7.1.2 database. the ODB file along with a folder and four subfolder with 4 graphic in them can be found here,

link text

I am working on the form "Form Setup" . I am writing a macro to populate the BirthCity textbox based on the item selected in the birthCitylst listbox. Here is the code I am using the "Mouse button pressed" event of that listbox. Here is the code.

    Sub pick_city_list
Dim oForm as Object
Dim countryText as string
Dim cityList as Object
Dim cityBox as Object
Dim oCountryList as Object
Dim oCountryBox as Object
Dim idebugCode as integer
Dim DatabaseContext As Object
Dim DataSource As Object
Dim Connection As Object
Dim InteractionHandler as Object
Dim Statement As Object
Dim ResultSet As Object
Dim Names As Object
Dim I As Integer

REM Determine if the countrylist text box has a value

oForm = ThisComponent.DrawPage.Forms.GetByName("dsPhotoInfo")
oCountryBox = oForm.getByName("birthCountry")

IF oCountryBox.text <> "" THEN

' Connect to database

    DatabaseContext = createUnoService("")
    Names = DatabaseContext.getElementNames()
        For I = 0 To UBound ( Names())
        MsgBox Names(I)
        Next I
        DataSource = DatabaseContext.getByName("Bibliography")
    If Not DataSource.IsPasswordRequired Then
        Connection = DataSource.GetConnection("","")
        InteractionHandler = createUnoService("")
        Connection = DataSource.ConnectWithCompletion(InteractionHandler)
    End If
    Print "No Country"
    EXIT SUB    
End Sub

I got the database access portion of the code from the Apache OpenOffice help pages here:

link text

When I first added the "DatabaseContext = createUnoService("") lines I kept getting and errore saying that no such object at the "DatabaseContext.getbyName() line. So I did more Googling and found this page.

link text

I added the code for display all the database names

DatabaseContext = createUnoService("")

Names = DatabaseContext.getElementNames()

For I = 0 To UBound(Names()) MsgBox Names(I) Next I

and got a dialog that one called "Bibliography" As you can see I inserted that in the DatabaseContext.getbyName() call and now things are working up this point.

My question is where did "Bibliograpy" come from. I do not recall naming anything with that when I created the database, the ODB file the tables or the forms. It is as though LibreOffice just pulled it out of thin air!!!.

edit retag flag offensive close merge delete



Edited for clarity. Use the Formatted text icon on the toolbar for code (toolbar in upper left of question/comment/answer). Select all the code & click on the icon.

BTW this is LibreOffice and not OpenOffice.

Ratslinger gravatar imageRatslinger ( 2021-04-28 05:22:21 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2021-04-28 05:27:30 +0200

Ratslinger gravatar image


"Bibliography" is a database which comes with LO. See -> Referencing Systems in LibreOffice. More oriented to Writer.

The retrieval of DB names as you have coded are for Registered base names. See menu Tools->Options. Then under LibreOffice Base->Databases the list is on the right.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-04-28 04:53:17 +0200

Seen: 37 times

Last updated: Apr 28