IF the form field doesn't exist, an error is being thrown. You may not actually see the error depending on if a <cftry> is wrapped around the query. Or sometimes I've just had errors that don't get thrown correctly.
On 11/25/06, Rick Faircloth <[EMAIL PROTECTED]> wrote: > Jim... (or anyone else)... > > Do you see anything wrong with this code (part of a larger query) > that would cause the query not to return no results if the following > formfields, > > Form.Earliest_Birthdate_Day and > Form.Earliest_Birthdate_Month and > Form.Latest_Birthdate_Day and > Form.Latest_Birthdate_Month > > are *not* used in the form (in other words, they CFIF at the beginning > of this part of the query should exclude this section from consideration > in the query). > > Here's the code: > > <CFIF Form.Earliest_Birthdate_Day is not "Day" > and Form.Earliest_Birthdate_Month is not "Month" > and Form.Latest_Birthdate_Day is not "Day" > and Form.Latest_Birthdate_Month is not "Month"> > > and ((Month(Client_Birthdate) = #Form.Earliest_Birthdate_Month# > and Day(Client_Birthdate) >= #Form.Earliest_Birthdate_Day#) > or Month(Client_Birthdate) > #Form.Earliest_Birthdate_Month#) > > <CFIF Form.Earliest_Birthdate_Month GT > Form.Latest_Birthdate_Month> > <!---This takes care of cases where the months go over a new > year---> > or > <CFELSE> > and > </CFIF> > > ((Month(Client_Birthdate) = #Form.Latest_Birthdate_Month# > and Day(Client_Birthdate) <= #Form.Latest_Birthdate_Day#) > or Month(Client_Birthdate) < #Form.Latest_Birthdate_Month#) > > </CFIF> > > Thanks, > > Rick > > PS - This was working fine yesterday, then today it just started returning > no results if the formfields "Earliest_Birthdate_Day", > "Earliest_Birthdate_Month", > "Latest_Birthdate_Day", and "Latest_Birthdate_Month" are not used. ??? > > > > -----Original Message----- > From: Jim Wright [mailto:[EMAIL PROTECTED] > Sent: Friday, November 24, 2006 4:22 PM > To: CF-Talk > Subject: Re: How do I get number of birthdays? > > > I think this will work...check the logic, though. > > WHERE ((Month(Client_Birth_Date) = #Form.Earliest_Birth_Month# AND > Day(Client_Birth_Date) >= #Form.Earliest_Birth_Day#) > OR Month(Client_Birth_Date) > #Form.Earliest_Birth_Month#) > <cfif Form.Earliest_Birth_Month GT Form.Latest_Birth_Month> > <!---This takes care of cases where the months go over a new year---> > OR > <cfelse> > AND > </cfif> > ((Month(Client_Birth_Date) = #Form.Latest_Birth_Month# AND > Day(Client_Birth_Date) <= #Form.Latest_Birth_Day#) > OR Month(Client_Birth_Date) < #Form.Latest_Birth_Month#) > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:261663 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

