RE: Combo Box, filter values

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Try changing your last SQL statement to:

"SELECT bedrijf FROM klanten WHERE bedrijf Like '*" & SearchWord & "*'" & "
ORDER BY bedrijf"

That is after the word Like you'll see one apostroph an asterisk and double
quotes. After the second & you'll find a double quote an asterisk a single
quote and a double quote.

That will do the trick you are looking for.
hth
--
Maurice Ausum


"Celfreak" wrote:

For a combo box I use a sql statement as basis.

SELECT Klanten.Bedrijf FROM Klanten ORDER BY Klanten.Bedrijf;

When I using the form, the list goes automatically to the name with the
(first) letters you type in the box. My problem is the list is getting bigger
and bigger, so I want to search in my combobox.

In SQL you can use the Where statement to narrow down the choices. For example
SELECT Klanten.Bedrijf FROM Klanten WHERE Klanten.Bedrijf Like '*BV*' ORDER
BY Klanten.Bedrijf; narrows down the list of the combobox the the values with
BV in their name.

This is a static statement and i want to make it more dynamic. What I want
is to have a (independent) field where you type your searchword that is used
by the combobox to narrow down the list. I tried many things, only I cannot
connect a field to the SQL statement.

What works is voor example
SELECT Klanten.Bedrijf FROM Klanten WHERE Klanten.Bedrijf Like '*'&
searchword &'*' ORDER BY Klanten.Bedrijf

I then get the message give parameter. Problem with this is that I cannot
change that parameter.
--
-
.



Relevant Pages

  • Re: Processing DynamicSQL with single quotes in the data
    ... However any varchar could have a quote in it - i.e. descriptions, ... Every SQL statement is being executed in C from a common handler OpenROAD procedure so ... It executes all non-SELECT statements with an EXEC SQL EXECUTE ...
    (comp.databases.ingres)
  • RE: does this sql capability exist
    ... more ways to dynamically create the SQL statement. ... what happens if you need to have a price for 1-25 items instead ... you convert the quote to a PO or create a separate PO later? ... I have 10 text boxes that represent 10 of the fields in my table ...
    (microsoft.public.access.formscoding)
  • Re: SQL statement contain " character
    ... The SQL statement produced is valid - it is accepted if I execute it against SQL Server in Query Analyzer. ... This is failing when the double quote is in there but works if it is taken out. ... Brian Bushay TeamB wrote: ...
    (borland.public.delphi.database.ado)
  • Re: Processing DynamicSQL with single quotes in the data
    ... with its counterpart to the extend that you can substitute all quotes ... string back to your program so it might be better to do the processing ... However any varchar could have a quote in it - i.e. descriptions, ... Every SQL statement is being executed in C from a common handler OpenROAD procedure so ...
    (comp.databases.ingres)
  • Re: Export Access2K table to another database
    ... I didn't try running your code, but at a quick glance, it looks like you're ... missing an asterisk in your SQL statement: ...
    (microsoft.public.access.modulesdaovba)