Well, the LIKE statement you are using is basically an =

If you want to use LIKE as a CONTAINS type search, you need to put % in it (LIKE 
'%#var#%')

Think of it as a wildcard character (like * in DOS)

If you want to anchor the search to the begining of the string :  '#var#%'
If you want to anchor the search to the end of the string :  '%#var#'
If you want the search to find it anywhere in the string :  '%#var#%'

HTH
Jerry Johnson

>>> [EMAIL PROTECTED] 05/22/02 02:08PM >>>
Hello,

I have a simple search code below that is searching an Access table, but it does not 
find the fields. Is there something I am missing?

Robert O.

<cfquery name="Getpo" datasource="purchases">
SELECT * FROM purchases where 0 = 0 

<CFIF IsDefined("FORM.invoicenumber")> 
        And invoicenumber LIKE '#FORM.invoicenumber#'
</CFIF>

<CFIF IsDefined("FORM.contact")> 
        And contact LIKE '#FORM.contact#'
</CFIF>

<CFIF IsDefined("FORM.vendor")>
        And vendor LIKE '#FORM.vendor#'
</CFIF>
                      
ORDER BY ID DESC

</cfquery>


Displayed at bottom:

Queries 
Getpo (Records=0, Time=16ms)
SQL = 
SELECT * FROM purchases where 0 = 0 

 
        And invoicenumber LIKE '2'
 
        And contact LIKE ''

        And vendor LIKE ''

                      


______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to