Got it working with this code: SELECT COUNT(*) as ClientCount FROM Clients WHERE Client_IntakeDate >= <cfqueryparam value="#Trim(Form.StartDate)#" cfsqltype="cf_sql_date"> AND Client_IntakeDate <= <cfqueryparam value="#Trim(Form.EndDate)#" cfsqltype="cf_sql_date"> AND #Trim(Form.Param1Select)# = <cfqueryparam value="#Trim(Form.Param1Val)#"> <cfif Form.Param2Select NEQ ""> AND #Trim(Form.Param2Select)# = <cfqueryparam value="#Trim(Form.Param2Val)#"> </cfif> <cfif Form.Param3Select NEQ ""> AND #Trim(Form.Param3Select)# = <cfqueryparam value="#Trim(Form.Param3Val)#"> </cfif> ;
On Wed, 3 Nov 2004 11:25:16 -0600, Donna French <[EMAIL PROTECTED]> wrote: > Okay, I see what you mean but I'm not sure how to define since they > are passed from selects instead of a db field? > > Thank you for your help, > ~ Donna > > > > > On Wed, 03 Nov 2004 01:59:39 +0100, Jochem van Dieten > <[EMAIL PROTECTED]> wrote: > > Donna French wrote: > > > Should this code work if I only pass the StartDate, EndDate and Param1Val? > > > > No. > > > > > > > > > > > <cfparam name="Param2Val" default="null"> > > > <cfparam name="Param3Val" default="null"> > > > > > > <cfinclude template="Connections/wdv.cfm"> > > > <cfquery name="rsReport" datasource=#MM_wdv_DSN# > > > username=#MM_wdv_USERNAME# password=#MM_wdv_PASSWORD#> > > > SELECT COUNT(Clients.Client_ID) as ClientCount > > > FROM Clients > > > WHERE > > > Client_IntakeDate >= <cfqueryparam value="#Form.StartDate#" > > > cfsqltype="cf_sql_date"> > > > AND > > > Client_IntakeDate <= <cfqueryparam value="#Form.EndDate#" > > > cfsqltype="cf_sql_date"> > > > AND > > > #Form.Param1# = <cfqueryparam value="#Form.Param1Val#" null="no"> > > > > This will throw an error because form.param1 is undefined. > > > > > AND > > > #Form.Param2# = <cfqueryparam value="#Form.Param2Val#" null="yes"> > > > > Here both form.param2 and form.param2val are undefined. Remember > > that your cfparam is for param2val, not form.param2val. (CF might > > skip past the param2val issue though since it is essentially a > > constant and the compiler might recognize it as such.) > > > > > AND > > > #Form.Param3# = <cfqueryparam value="#Form.Param3Val#" null="yes">; > > > > Same issue. > > > > > </cfquery> > > > > Jochem > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF community. http://www.houseoffusion.com/banners/view.cfm?bannerid=35 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:183278 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54