Title: Message
you have probably solved this by now, but here goes anyway:
 
<cfset Form.age = 5>
<!--- set age diff --->
<cfset Older = Form.age + 2>
<cfset Younger = Form.age - 2>
 
<!--- create the dates --->
<cfset Olderthan = dateformat(DateAdd("yyyy", -Older, Now()),'yyyy-mm-dd')>
<cfset Youngerthan = dateformat(DateAdd("yyyy",-Younger,Now()),'yyyy-mm-dd')>

<!--- get all records where member was born between #Olderthan# and #Youngerthan# --->
<cfquery name="getRecord" datasource="interact">
 SELECT  Talent.talentID , 
  Talent.Name ,
  Talent.Gender ,
  Talent.DOB ,
  Talent.Hair ,
  Talent.Eye ,
  Talent.Height ,
  Talent.Clothessize ,
  Talent.shoesize ,
  Talent.hobbies ,
  Talent.BIO ,
  Talent.Compcard ,
  Talent.ID
 FROM   Talent
 where (Talent.DOB <= {d '#Olderthan#'}
 and Talent.DOB >= {d '#Youngerthan#'})
</cfquery>
 
take note of the positioning of the squiggly brackets "{ }" as opposed to the normal brackets "( )"
 
steve
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 19 March 2003 10:09 PM
To: CFAussie Mailing List
Subject: [cfaussie] New look up date by years old with a 2 year spread < 2 > 2

Hi
thank you for all who helped yesterday
i am still stuck so i decided to clean up and simplfy the code to help debug
 
here we go again:
 
 
<cfset Form.age =5>
<!--- set age diff --->
<cfset Older = Form.age + 2>
<cfset Younger = Form.age - 2>
 
<!--- create the dates --->
<cfoutput>
<cfset Olderthan = #CreateODBCDateTime(DateAdd("yyyy", -Older, Now()))#><br>
<cfset Youngerthan = #CreateODBCDateTime(DateAdd("yyyy",-Younger,Now()))#>
get all records where member was born between #Olderthan# and #Youngerthan#
</cfoutput>
 
<cfquery name="getRecord" datasource="interact">
 <cfoutput><pre>
 SELECT  Talent.talentID , 
  Talent.Name ,
  Talent.Gender ,
  Talent.DOB ,
  Talent.Hair ,
  Talent.Eye ,
  Talent.Height ,
  Talent.Clothessize ,
  Talent.shoesize ,
  Talent.hobbies ,
  Talent.BIO ,
  Talent.Compcard ,
  Talent.ID
 FROM   Talent
 where Talent.DOB between ('#Olderthan#') and ('#Youngerthan#')
</pre></cfoutput>
</cfquery>
 
 
get all records where member was born between {ts '1996-03-19 22:06:56'} and {ts '2000-03-19 22:06:56'}
 
The ERROR MESSAGE

<FONT size=3></PLAINTEXT><PRE></PRE></Q></S></SAMP>></SMALL></STRIKE></STRONG></SUB></SUP></TABLE></TD></TH></TITLE></TR></TT></U> <UL></UL></VAR></WBR><XMP></XMP> <HR> <H3>Error Occurred While Processing Request</H3> <P> <TABLE border=1> <TBODY> <TR> <TD> <H4>Error Diagnostic Information</H4> <P>ODBC Error Code = 37000 (Syntax error or access violation) <P> <P>[Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. <P> <P>SQL = "<PRE> SELECT Talent.talentID , Talent.Name , Talent.Gender , Talent.DOB , Talent.Hair , Talent.Eye , Talent.Height , Talent.Clothessize , Talent.shoesize , Talent.hobbies , Talent.BIO , Talent.Compcard , Talent.ID FROM Talent where Talent.DOB between ('{ts '1996-03-19 22:06:56'}') and ('{ts '2000-03-19 22:06:56'}') </PRE>" <P>Data Source = "INTERACT" <P> <P>The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (16:1) to (16:48) in the template file C:\Documents and Settings\Greg Stone.GREG\My Documents\client coldfusion workfiles\interact\application\members\test.cfm.</P></FONT> --- 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/�<P><FONT color=#000000 face="Arial" size=2></FONT></td></tr></table> </div> <div class="msgButtons margintopdouble"> <ul class="overflow"> <li class="msgButtonItems"><a class="button buttonleft " accesskey="p" href="msg02560.html">Previous message</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="c" href="index.html#02561">View by thread</a></li> <li class="msgButtonItems textaligncenter"><a class="button" accesskey="i" href="maillist.html#02561">View by date</a></li> <li class="msgButtonItems textalignright"><a class="button buttonright " accesskey="n" href="msg02564.html">Next message</a></li> </ul> </div> <a name="tslice"></a> <div class="tSliceList margintopdouble"> <ul class="icons monospace"> <li class="icons-email"><span class="subject"><a href="msg02564.html">[cfaussie] RE: New look up date by years old with a 2 year s...</a></span> <span class="sender italic">cliftosg</span></li> <li><ul> <li class="icons-email"><span class="subject"><a href="msg02564.html">[cfaussie] RE: New look up date by years old with a 2 y...</a></span> <span class="sender italic">Mark Stanton</span></li> <li class="icons-email"><span class="subject"><a href="msg02571.html">[cfaussie] RE: New look up date by years old with a 2 y...</a></span> <span class="sender italic">stone</span></li> <li class="icons-email"><span class="subject"><a href="msg02572.html">[cfaussie] RE: New look up date by years old with a 2 y...</a></span> <span class="sender italic">Mark Stanton</span></li> <li class="icons-email"><span class="subject"><a href="msg02576.html">[cfaussie] RE: New look up date by years old with a 2 y...</a></span> <span class="sender italic">cliftosg</span></li> <li class="icons-email"><span class="subject"><a href="msg02577.html">[cfaussie] RE: New look up date by years old with a 2 y...</a></span> <span class="sender italic">stone</span></li> </ul> </ul> </div> <div class="overflow msgActions margintopdouble"> <div class="msgReply" > <h2> Reply via email to </h2> <form method="POST" action="/mailto.php"> <input type="hidden" name="subject" value="[cfaussie] RE: New look up date by years old with a 2 year spread &lt; 2 &gt; 2"> <input type="hidden" name="msgid" value="LYRIS-3664-41698-2003.03.20-08.32.54--archive#mail-archive.com@lists.daemon.com.au"> <input type="hidden" name="relpath" value="cfaussie@lists.daemon.com.au/msg02561.html"> <input type="submit" value=" cliftosg "> </form> </div> </div> </div> <div class="aside" role="complementary"> <div class="logo"> <a href="/"><img src="/logo.png" width=247 height=88 alt="The Mail Archive"></a> </div> <form class="overflow" action="/search" method="get"> <input type="hidden" name="l" value="cfaussie@lists.daemon.com.au"> <label class="hidden" for="q">Search the site</label> <input class="submittext" type="text" id="q" name="q" placeholder="Search cfaussie"> <input class="submitbutton" name="submit" type="image" src="/submit.png" alt="Submit"> </form> <div class="nav margintop" id="nav" role="navigation"> <ul class="icons font16"> <li class="icons-home"><a href="/">The Mail Archive home</a></li> <li class="icons-list"><a href="/cfaussie@lists.daemon.com.au/">cfaussie - all messages</a></li> <li class="icons-about"><a href="/cfaussie@lists.daemon.com.au/info.html">cfaussie - about the list</a></li> <li class="icons-expand"><a href="/search?l=cfaussie@lists.daemon.com.au&amp;q=subject:%22%5C%5Bcfaussie%5C%5D+RE%5C%3A+New++look+up+date+by+years+old+with+a+2+year+spread+++%3C++2+++%3E+2%22&amp;o=newest&amp;f=1" title="e" id="e">Expand</a></li> <li class="icons-prev"><a href="msg02560.html" title="p">Previous message</a></li> <li class="icons-next"><a href="msg02564.html" title="n">Next message</a></li> </ul> </div> <div class="listlogo margintopdouble"> </div> <div class="margintopdouble"> </div> </div> </div> <div class="footer" role="contentinfo"> <ul> <li><a href="/">The Mail Archive home</a></li> <li><a href="/faq.html#newlist">Add your mailing list</a></li> <li><a href="/faq.html">FAQ</a></li> <li><a href="/faq.html#support">Support</a></li> <li><a href="/faq.html#privacy">Privacy</a></li> <li class="darkgray">LYRIS-3664-41698-2003.03.20-08.32.54--archive#mail-archive.com@lists.daemon.com.au</li> </ul> </div> </body> </html>