is it possible to do something like:
select * from table1 where table1.field = (value from combo box)?
Thanks
[Solved] SQL criteria from a Combo Box value
-
- Posts: 25
- Joined: Mon Dec 01, 2008 10:44 pm
[Solved] SQL criteria from a Combo Box value
Last edited by greenpoise on Thu Dec 18, 2008 3:26 pm, edited 1 time in total.
OOo 3.0.X on Linux-Other
Re: SQL criteria from a Combo Box value
Bind the fields in question to text boxes and set their property "Filter Proposal". While in form-filter mode you can pick values from lists and combine them to arbitrary complex aggregations of criteria. There is even a "filter navigator". But the trick works for a single fields as well.
My combo_filter3.odb is a little bit ugly. I try to demonstrate 2 ways to do the trick without the need of writing macros.
Form1 follows a form-subform approach.
Form2 uses 2 independent forms and allows to remove the filter. Unfortunately it's read-only, which may be resolved somehow.
Form21 is a copy of Form2, bound to a field of multiple chars to demonstrate a starts-with ... filter.
In any case a helper table "Filter" is used for the binding of the combo box or as a restriction of the underlying query respectively.
And then there are tons of macros. As far as I know, they all need to be installed in parallel, assume certain naming conventions and/or data types, handle one single box only.
My combo_filter3.odb is a little bit ugly. I try to demonstrate 2 ways to do the trick without the need of writing macros.
Form1 follows a form-subform approach.
Form2 uses 2 independent forms and allows to remove the filter. Unfortunately it's read-only, which may be resolved somehow.
Form21 is a copy of Form2, bound to a field of multiple chars to demonstrate a starts-with ... filter.
In any case a helper table "Filter" is used for the binding of the combo box or as a restriction of the underlying query respectively.
And then there are tons of macros. As far as I know, they all need to be installed in parallel, assume certain naming conventions and/or data types, handle one single box only.
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 25
- Joined: Mon Dec 01, 2008 10:44 pm
Re: SQL criteria from a Combo Box value
Villeroy. Thanks for the help. Great explanation indeed. I am still a bit lost because when I open your example,
I see a multiselection control with no properties. Sorry for my ignorance as I am new to OOffice. Now, when
you mention bound, there is no bound properties on a common combo box or at least mine does not show it.
What type of control did you use?
Thanks again
dan
I see a multiselection control with no properties. Sorry for my ignorance as I am new to OOffice. Now, when
you mention bound, there is no bound properties on a common combo box or at least mine does not show it.
What type of control did you use?
Thanks again
dan
OOo 3.0.X on Linux-Other
Re: SQL criteria from a Combo Box value
There is a combo on top of each form and a refresh button right of the combo. In the lower part there is a series of text fields comprised in a grid control (I see a grid control as a container which shows one instance of the same control(s) per record).
Open Form1 in edit mode.
Get toolbar "Form Design"
Get the "form navigator" from button #5.
You see the hierarchy of forms with one main form, having a combo box grouped with a label and a subform holding the grid and the button to refresh the subform rather than the main form. Notice the different sources of the forms.
While you are in it, improve the form's usability:
Select the subform, get it's properties and set property "Cycle" on tab "Data" to "Current Page".
Push button #7 on "FOrm Design" and set the refresh button on top of the subform's tab-order.
Explore the other forms in the same way. For me, the "Form Design" toolbar and it's navigator are the most important tools to understand forms, particulary when you created the forms by form-wizard.
Open Form1 in edit mode.
Get toolbar "Form Design"
Get the "form navigator" from button #5.
You see the hierarchy of forms with one main form, having a combo box grouped with a label and a subform holding the grid and the button to refresh the subform rather than the main form. Notice the different sources of the forms.
While you are in it, improve the form's usability:
Select the subform, get it's properties and set property "Cycle" on tab "Data" to "Current Page".
Push button #7 on "FOrm Design" and set the refresh button on top of the subform's tab-order.
Explore the other forms in the same way. For me, the "Form Design" toolbar and it's navigator are the most important tools to understand forms, particulary when you created the forms by form-wizard.
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 25
- Joined: Mon Dec 01, 2008 10:44 pm
Re: SQL criteria from a Combo Box value
Thanks..I have to check out a bit more but it is what I need. I appreciate it!!
OOo 3.0.X on Linux-Other