Ask Your Question
0

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

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

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
1

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

frofa 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 flag offensive delete link more
1

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

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

Stats

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

Seen: 862 times

Last updated: Feb 06 '15