Ask Your Question

How to create a method of searching databases, without creating a new query every time?

asked 2015-02-04 05:32:05 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

For arguments sake I work in a "real estate" office. I want to create a database of several buildings, with records of all the residents in each building and all the contractors that work on each building. I'm trying to construct a reusable method of searching for a resident or contractor without creating a new query every time.

I'm envisaging something that looks like a form, with a "search" and "clear" button.

Forgive my possibly obvious question, I am new to databases.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2015-02-06 06:13:22 +0100

frofa gravatar image

updated 2020-08-15 15:27:21 +0100

Alex Kemp gravatar image

You will need to study FORM-BASED FILTERING techniques. The standard form-based filter buttons at the bottom of your FORM (see attached screenshot) will likely do the job, but if you need more flexible techniques try DACM's examples as a good starting point. Essentially these extended methods allow you to type in (or select from drop-down lists) various search critieria (e.g. someone's name), and a linked sub-form will show you all the results (or a single result if there is only one).

form-based filter button.png

(edit: activated screenshot)

edit flag offensive delete link more

answered 2015-02-06 06:32:00 +0100

doug gravatar image

Simplest way is to create a query that generates a dialog prompt. As a constraint in the query, type a placeholder name to identify the value, preceded by a colon ( : ), i.e, :enter_variable . When you run the query, you will get a dialog box that requests the value for enter_variable, and then displays the query using the variable you entered into the dialog box. It will look like this:

image description

The query can be used as the source for the form. h/t Nocton@ooForum

Push button would be more sophisticated. For some detail about programmatically navigating through records in a form, see LO form Q/A Open form via macro in Libreoffice Base.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-02-04 05:32:05 +0100

Seen: 1,013 times

Last updated: Aug 15 '20