Howto connect "file selection" button to my data table [Base form]

Hello,

I m a little beginner in LibreOffice base. I saw that I can add a “file selection” button to a form. But how can I use this information in my form of database? For example to add the filename to the table.

Thanks for reaction

Hello,

You can use a macro to access the selected name and then do with it as you want such as continue the macro to insert into an existing field name. Sample macro:

Sub Snippet
  Dim oForm As  Object
  Dim oField As Object
  Dim sText As  String
  oForm = ThisComponent.getDrawPage().getForms().getByIndex(0)
  oField = oForm.getByName("File Selection 1")
  sText = oField.Text
End Sub

Edit:

Please be aware, the code obtains the first internal form - getByIndex(0). Also the example uses the control named File Selection 1. Adjust as needed.

Seems me reasonable, I will test your suggestion.

Is there anywhere documentation about the structure and names of all that objects?

These two documents provide most needed information. Warning, they are not small:

@joppla,

Is this question related to the post on the Dutch forum where you ask about a macro to import an image? If so, I believe that question is not explained well enough and you may be taking a wrong direction.

If you are attempting to store the location of the image, view it but not embed it, then simply use an image control connected to a varchar field. This is linking an image. Size of the field should be 100-200 characters depending on file location.

Yes, it is related, do you mind to continue the discussion on the Dutch forum? I don’t mind to publish the solution here, but I prefer to discuss in Dutch to come to the solution.

Shall I explain my idea on the Dutch forum some better?

Wow, the documents are pretty large.
I remember from the time that I was writing VBA that there were quite sufficient help tools that show you the possible structure of the object that you was creating. It isn’t in LibreOffice?

@Ratslinger: Let’s continue here