[Solved] Selecting record from a table with key field value

Creating tables and queries
Post Reply
murraymr
Posts: 8
Joined: Mon Mar 31, 2014 8:54 pm

[Solved] Selecting record from a table with key field value

Post by murraymr »

Years ago I built a system with Access and MySQL, in which a user would enter all or part of a surname to get the main client record displayed. A combo box was used to display a popup for entry of the search argument. A query then displayed all the possible matches for the user to select. Where can I find instructions to tell me how to do this in Base, with Open Office 4.1.2 and Windows 10?
Last edited by murraymr on Sat Aug 13, 2016 7:57 pm, edited 1 time in total.
Open Office 4.1.2 on Windows 10
UnklDonald418
Volunteer
Posts: 1549
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Selecting a record from a table with key field value

Post by UnklDonald418 »

Here are links to a couple of videos covering the basics of creating Combo Boxes on OOBase forms
http://showmedo.com/videotutorials/vide ... esID%3D112
https://www.youtube.com/watch?v=aOkkqaHRgzY
or a non-video tutorial at
http://sheepdogguides.com/fdb/fdb1listb.htm
For more advanced uses there is a tutorial at
viewtopic.php?f=100&t=42845
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
murraymr
Posts: 8
Joined: Mon Mar 31, 2014 8:54 pm

Re: Selecting a record from a table with key field value

Post by murraymr »

Thank you for your response to my cry for help! I had found the first video, but what I realised I needed was help in setting up a combo box with all the code I had used in MS Access. I have found the LibreOffice Base handbook, which has shown me how to use the Standard Filter to find a single record in a table, using a value for one or more fields. A very simple and elegant solution!
Open Office 4.1.2 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Selecting a record from a table with key field valu (Sol

Post by Villeroy »

download/file.php?id=21951
Open the "ID Filter" form. Pick an ID number from the list box and hit OK. The unique ID identifies one particular record from the "Data" table.
The subform shows the selected record. Now you can print the form or you can print the report named "Report3" which refers to the same ID value which is stored in row #5 of table "Filter".

The content of the list box is

Code: Select all

SELECT "ID", "ID" FROM "Data"
First ID field is the visible field, second one is the content that gets written into the criteria table.
If the "Data" table where a list of persons, you could use a concatenation like this:

Code: Select all

SELECT "Surname" || ', '  "Forename" || ' - '|| "Birthday" AS "Visible", "ID" FROM "Data"
which would show entries like

Code: Select all

Doe, John - 1943-12-31
while writing the respective ID value into the criteria table.

btw: a combo box is nothing but a simple text box with auto-complete.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply