try changing your isdefined(#SubCategory1#) to isdefined("SubCategory1")
also, it looks like you're going to get an error anyway - if the elseif part of your block gets run, you'll have a sql statement which reads something like: SELECT ... FROM ... OR ... which will throw an error. -----Original Message----- From: Richard L Smith [mailto:[EMAIL PROTECTED]] Sent: 17 December 2001 15:19 To: CF-Talk Subject: BrainFART: CFQuery conditional excecution Hello, I trying to get this cfquery to run based on what link the user clicks, i.e. if the user clicks "somepage.cfm?SubCategory1=#SubCategory1#" then the first part of the WHERE should execute else the the OR should execute. I have tried CFQueryParam to no avail, here is the code I am using so far. Rick <cfquery name="qCart" datasource="dsMain" dbtype="ODBC"> SELECT ItemName, BrandName, RetailEach, RetailUnit, UnitSize, DetailedDescription, ItemNumber, MainCategory, SubCategory1, SubCategory2 FROM MasterItemTable <cfif isdefined(#SubCategory1#)> WHERE (SubCategory1 = '#SubCategory1#') <cfelse isdefined(#SubCategory2#)> OR (SubCategory2 = '#SubCategory2#') </cfif> </cfquery> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists