Add search button in form

i have made a form in base so i want to make the search button that i would be able to seach any data in future kindly tell me the option how to make this!?

Hi

By default the navigation bar already includes this tool (the first tool in the toolbar). If you have not disabled this bar you already have this function (you can (dis)enable the navigation bar in Form properties▸Data tab).

If you really want to add a button on the form you can record a search in a macro and then assign the macro to the button. The generated macro is something like:

sub Search
dim document   as object
dim dispatcher as object
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:RecSearch", "", 0, Array())

end sub

Note: you have to enable ToolsOptionsLibreOfficeAdvancedEnable macro recording if you want to recreate the macro above.

Regards