Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index

On 08/08/14 11:29, Alexander Thurgood wrote:
Le 08/08/2014 16:10, lunixbox a écrit :
Sorry i was not clear, its more how to set up the search query /form as
i doubt you can go on for 400 points to search. Org question  :
What i want using cars as example is to make a search for
color,year,doors,model.kilometers driven,cabrio,engine,fuel and so many
more options.:
The many options make me wonder what is a smart way.
The data is no where, i just wonder how you solve this where the number
of options/selection  is maybe 300+

The basic question is whether or not your data is one table, or multiple
tables. Seems to me that you could probably break it down into smaller
chunks, where the chunks represent options you can lump together. Of
course, if your query needs to find any make of car, of any colour, of
any bhp, etc, ad nauseam, then you are going to be in for a fun time
designing your form. Ideally, you would normalise your data sets before
embarking on such an adventure.


The form you will need to list all these parameters will be massive in
itself.  How are you going to fit them all on one form?

Here's my suggestion.  For each parameter use a list box on the form
that is populated with the various instances of data in your tables

sql= select distinct color from tbl_Cars where COLOR is not null

Then you can avoid selection of colors that don't exist in your data
set.  Do that for each parameter of your search.

What you have all the required parameters selected then use BASIC to
build your query "where" clause.

strWhere = ""
If listbox_Color is not null then
        if strWhere = "" then
                strWhere = "WHERE COLOR = "contents of listbox_Color"
                strWhere = " AND COLOR = "contents of listbox_Color"
        end if
end if

Just keep appending each populated parameter onto the end of strWhere.
When you finish building your WHERE clause you paste it onto the end of
your SQL query"

strSQL = "Select * from tbl_Cars " & strWhere & ";"

if you have multiple tables your will have to use joins and specify the
table names as well as the field names in your WHERE clause.

   ^ ^  Mark LaPierre
Registered Linux user No #267004

To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.