Hi, I have an ASP page where I am trying to return a recordset (from an
Access DB) based on an age range eg. 30 - 40.  The SQL query needs to
retrieve these records based on a date of birth field.  I'm using the
DATEDIFF function in my SQL string but this doesn't seem to allow for
people that haven't yet had their birthday this year.
eg. A date of birth of 1-Oct-1972 when the current date is 4-Sep-2003
would return an age of 31 which is not correct.

Here's my SQL string:
strSQL = "SELECT * FROM myTable WHERE ((DateDiff('yyyy',DOBfield,DATE()) 
BETWEEN 30 AND 40));"

Because of the way the rest of my page works I need to get these results
using the SQL query as opposed to validating the ages with a VB script
function once the recordset has been returned.

Can anyone shed light on this?

Thanks in advance,
Clancy

____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set 
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to