I believe you have to use '%' such as:

SELECT * FROM purchases where 0 = 0 


        And invoicenumber LIKE '%2%'
 
        And contact LIKE '%%'

        And vendor LIKE '%%'


-----Original Message-----
From: Robert Orlini [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 22, 2002 2:09 PM
To: CF-Talk
Subject: search problem


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 ''

                      


______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
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