Problem with two ListBox in my form

Creating and using forms

Problem with two ListBox in my form

Postby ruzicka15 » Sun May 20, 2018 3:30 pm

Hi, I am having problem with my ListBoxes in my form. I made one form with two listboxes to be able to search in the table, and one subform with the table itself. Listboxes work well when they are both filled with some data but I need them to work when is filled just one of them. For example if I would have a table with sex and hair-color and I fill just the sex listbox, it should show just males for example with all the haircolors. But in my case it show nothing when I leave one of the fields empty.
I hope you understood it and thank you for your advices!
OpenOffice 4.1.5. on Windows 10
ruzicka15
 
Posts: 1
Joined: Sun May 20, 2018 3:16 pm

Re: Problem with two ListBox in my form

Postby Villeroy » Sun May 20, 2018 4:53 pm

Source of subform:
Code: Select all   Expand viewCollapse view
SELECT *
FROM "Table"
WHERE "SEX" = :paramSEX
  AND ("COLOR" = :paramCOLOR OR :paramCOLOR IS NULL)

link the parend form's fields to the child form's parameter names :paramSEX and :paramCOLOR.

The WHERE clause selects a record if the sex matches AND (if either the color matches OR the color is empty).
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27301
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Forms

Who is online

Users browsing this forum: No registered users and 3 guests