How to populate text fields from a sql query.

I have a form with a button. When button is pressed I want to run a query selecting certain data from database and then fill in the text blocks on the form. Some data will have to manipulated before filling the text box.

What have you tried so far? There is plenty of documentation for Base forms on the web, and many questions on this site as well. See guidelines for asking.

This question seems similar or somewhat of a duplicate of your other question here → run python as macro in base on push of button. Comment there was never replied to.


If you are going to do things to the retrieved data before it is inserted in controls on a form, you will probably want to do this through macros.

See → In base Convert Query to macro and links in my answer

Also → handle runtime error sql macro

Some documentation/tutorial links → To learn LibreOffice Base are there introductions or tutorials? Here under INDEPENDENT DOCUMENTATION see OOME by Andrew Pitonyak - AOO/LO macro guide.

Thanks to all who replied. I think I should be able obtain the details I require.
I have done some programming in VB but not used Libre Office. I am looking forward to becoming more acquainted with LO so that I can run some programs in it.

Please do not user answer for a response but rather a comment. Answers are to respond to original question. (It is acceptable to answer your own question).

Also, if an answer has answered your question please tick the :heavy_check_mark: (upper left area of answer). It helps others to know there was an accepted answer.