Greg
 
"[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1"
 
This means the you are either missing a something
 
even try this
 
<cfset form.olderthan =5>
<cfset form.youngerthan =1>
<cfset form.search = "yes">
<cfset form.gender = "male">
<cfset form.hair = "">

<cfquery name="getRecord" datasource="interact">
	SELECT  Talent.talentID ,  
		Talent.Name , 
		Talent.Gender , 
		Talent.DOB , 
		Talent.Hair , 
		Talent.Eye , 
		Talent.Height , 
		Talent.Clothssize , 
		Talent.shoesize , 
		Talent.hobbies , 
		Talent.BIO , 
		Talent.Compcard , 
		Talent.ID
	FROM  	Talent
	<cfif parameterexists(url.id)>
	WHERE Talent.ID = #url.ID#
	<cfelse>
		<cfif parameterexists(form.search)>
			WHERE Talent.gender = '#form.gender#'
			<!--- Check for age --->
			<!--- If we want an age range --->
			<cfif form.olderthan and form.youngerthan>
			AND (dob BETWEEN DateAdd(Year,#Form.OlderThan#,dob) AND DateAdd(Year,#Form.YoungerThan#,dob))
			</cfif>
			<!--- If we want all people younger than an age --->
			<cfif form.youngerthan and not form.olderthan>
			AND (dob < dateadd(year,#form.youngerthan#,dob))
			</cfif>
			<!--- If we want all people older than an age --->
			<cfif not form.youngerthan and form.olderthan>
			AND (dob > DateAdd(Year,#Form.OlderThan#,dob))
			</cfif>
			<cfif form.hair is not "">
			and talent.hair = '#form.hair#'
			</cfif>
		</cfif>
	</cfif>	
</cfquery>
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, 19 March 2003 3:57 PM
To: CFAussie Mailing List
Subject: [cfaussie] Re: look up date by years old with a 2 year spread < 2 > 2

Hi this is the exact code.
and current error message.
 
My thinking is its the dob field is not being reference in the query.
 
all i want to do is get all records between the age of  say 2 years old and 4 years old based on the value in the database DOB which is the date of birth  eg 18/03/2000 this record would be selected as well as anyother that fell in betwenn the minus 2 years from today and 4 years from today 
 
between 18/03/2001 and 18/03/1999 
 
the value i send to the querry is AGE  lets say 3 
 
May be i should be doing a now() - 2 and now()-4 as the between values..
 
HMMMMM is that more like it?????
any pointers will be most appresiated
 

[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.

Hint: The cause of this error is usually that your query contains a reference to a field which does not exist. You should verify that the fields included in your query exist and that you have specified their names correctly.

SQL = "SELECT Talent.talentID , Talent.Name , Talent.Gender , Talent.DOB , Talent.Hair , Talent.Eye , Talent.Height , Talent.Clothssize , Talent.shoesize , Talent.hobbies , Talent.BIO , Talent.Compcard , Talent.ID FROM Talent WHERE Talent.gender = 'male' AND dob BETWEEN DateAdd(Year,7,dob) AND DateAdd(Year,3,dob)"

 
<cfset Form.age =5>
<!--- set age diff --->
<cfset Form.OlderThan = Form.age + 2>
<cfoutput>#Form.OlderThan#</cfoutput>
<cfset Form.YoungerThan = Form.age - 2>
<cfoutput>#Form.youngerThan#</cfoutput>
 

<cfset form.search = "yes">
<cfset form.gender = "male">
<cfset form.hair = "">
 
 
 
<CFQUERY name="getRecord" dataSource="interact">
 SELECT  Talent.talentID , 
   Talent.Name ,
   Talent.Gender ,
   Talent.DOB ,
   Talent.Hair ,
   Talent.Eye ,
   Talent.Height ,
   Talent.Clothssize ,
   Talent.shoesize ,
   Talent.hobbies ,
   Talent.BIO ,
   Talent.Compcard ,
   Talent.ID
 FROM  Talent
 

 <CFIF ParameterExists(url.ID)>
 WHERE  Talent.ID = #url.ID#
 </CFIF>

<!--- Check for gender --->
<CFIF ParameterExists(form.search)>
 WHERE  Talent.gender = '#form.gender#'
<!--- Check for age --->
  <!--- If we want an age range --->
  <CFIF Form.OlderThan AND Form.YoungerThan>
   AND dob BETWEEN DateAdd(Year,#Form.OlderThan#,dob) AND DateAdd(Year,#Form.YoungerThan#,dob)
  </cfif>
 
<!--- If we want all people younger than an age --->
  <cfif Form.YoungerThan AND NOT Form.OlderThan>
   AND dob < DateAdd(Year,#Form.YoungerThan#,dob)
  </cfif>
 
<!--- If we want all people older than an age --->
  <cfif NOT Form.YoungerThan AND Form.OlderThan>
   AND dob > DateAdd(Year,#Form.OlderThan#,dob)
  </cfif>

  
   <CFIF form.hair IS NOT "">
   and talent.hair = '#form.hair#'
   </CFIF>
  
  
</CFIF>
 
</CFQUERY>
 
thanks
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to