Code for Find Record Macro in Base

Is there macro code for finding a record which can be linked to a pushbutton?

Any help would be appreciated.

Ratslinger, Thanks for the prompt to be more specific. I am using Big Sur on an iMac and am just looking to have a general search across any of the fields on a form i.e author or title of a book etc. I realise under the form controls in LibreOffice there are the search binocular but I have disabled the form controls on the from and was wondering could I use a Push Button on the form? I am assuming I am using HSQLDB?

Hello,

There is not enough information in the question to give a reasonable answer. Is a macro really necessary? What exactly are you looking to accomplish - general search; specific search; list box entry; text box and more. Please be more specific. And with all questions, please provide specific LibreOffice version, database used ( such as HSQLDB embedded) and your OS.

Please edit your question. Do NOT use an answer. Answers are only for answering the question itself.

Hello,

Still not quite certain of the request. Based on further information, it appears you want a button to execute a macro to bring up the Record Search dialog which you state you turned off the control. This macro:

Option Explicit
sub SearchDialog
rem ----------------------------------------------------------------------
rem define variables
    dim document   as object
    dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
    document   = ThisComponent.CurrentController.Frame
    dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
    dispatcher.executeDispatch(document, ".uno:RecSearch", "", 0, Array())
end sub

will display that dialog. You can attach to a button event of Mouse button released for example.

Thanks for this further response. I will try it out.

Ratslinger,

Apologies for the delay in replying to your answer. The code was exactly what I needed to link with a push button on the main screen of my database and does exactly what I wanted it to do. One further query if you can help once again. How can I ensure that when I open the search dialog box that it doesn’t cover the main database screen?

@HarryMac,

Currently have no method to re-position an LO dialog.