Hi Mark

I think i have my logic wrong anyway.
what i want to do is just get all dates within a date range.
 
there must be a different way to do this.

Here is the out put.

Error Diagnostic Information

ODBC Error Code = 37000 (Syntax error or access violation)

[Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.

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,5,dob) AND DateAdd(Year,1,dob))
			
			 
			
			
			
			
			
		
		
"

Data Source = "INTERACT"

The error occurred while processing an element with a general identifier of (CFQUERY), occupying document position (21:1) to (21:48) in the template file C:\Documents and Settings\Greg Stone.GREG\My Documents\client coldfusion workfiles\interact\application\members\test.cfm.

Date/Time: 03/19/03 17:41:17
Browser: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; MSOCD; YComp 5.0.2.4; .NET CLR 1.0.3705)
Remote Address: 127.0.0.1

----- Original Message -----
Sent: Wednesday, March 19, 2003 5:25 PM
Subject: [cfaussie] Re: look up date by years old with a 2 year spread < 2 > 2


>question why is the query not showing an 12-12-2003 on dob highted in red

Your original code was

<!--- 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>

This DateAdd function is being run in Access not CF. I am guessing its
something like this DateAdd(Date part,first date, second date).

Your first date is the coldfusion variable thats coming in from cf and the
second date is the dob field in the database.

You may want to prefix these fields with the table name to prevent
confusion. EG.
<!--- If we want all people younger than an age --->
  <cfif Form.YoungerThan AND NOT Form.OlderThan>
   AND Talent.dob < DateAdd(Year,#Form.YoungerThan#,Talent.dob)
  </cfif>

<!--- If we want all people older than an age --->
  <cfif NOT Form.YoungerThan AND Form.OlderThan>
   AND Talent.dob > DateAdd(Year,#Form.OlderThan#,Talent.dob)
  </cfif>


Can you try copying your query to just above your cfquery tags and surround
it with <cfoutput> and <pre> tags. This will output exatly what is being run
on the database. If you post the output of this it may be easier to debug.

Cheers

Mark


______________
Mark Stanton
Web Production
Gruden Pty Ltd
Tel: 9956 6388
Mob: 0410 458 201
Fax: 9956 8433
www.gruden.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/
---
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