Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with DateDiff 1

Status
Not open for further replies.

Tinabkr

Programmer
Jul 27, 2000
5
US
&lt;cfquery name=&quot;delete&quot; datasource=&quot;datasources&quot;&gt;<br>Delete * <br>From Events<br>Where datediff ('d',Dateof,now())&gt;30 <br>&lt;/cfquery&gt;<br><br>I keep getting a &quot;Data type mismatch in criteria expression&quot; error.&nbsp;&nbsp;All the fields in the table are text. Help!!!!
 
Because if you use CF functions then you must wrap then in the # sybol, otherwise they will be processed as the text and not the function.<br><br>Where #datediff ('d',Dateof,now())# &gt;30 <br> <p>Russ Michaels<br><a href=mailto:russ@satachi.com>russ@satachi.com</a><br><a href= Internet Development</a><br>For my personal book recommendations visit <br>
 
Now I'm recieveing an error that says this:<br><br>Error resolving parameter DATEOF<br><br>&nbsp;ColdFusion was unable to determine the value of the parameter. This problem is very likely due to the fact that either: <br><br>&nbsp;&nbsp;&nbsp;1.You have misspelled the parameter name, or <br>&nbsp;&nbsp;&nbsp;2.You have not specified a QUERY attribute for a CFOUTPUT, CFMAIL, or CFTABLE tag.<br><br>&nbsp;The error occurred while evaluating the expression: <br><br>&nbsp;#datediff ('d',Dateof,now())#<br><br>But the name of the field in the table is correct.&nbsp;&nbsp;<br><br>Thanks for your suggestion I have moved the pound signs all over in the equations, but I still get this error.
 
A couple questions:<br><br>Is Dateof a column or a CF variable?<br><br>What database are you using?<br><br>If Dateof is a column and you're using SQL Server, try <br><FONT FACE=monospace><b><br>Where datediff (day,Dateof,getdate())&gt;30 <br></b></font><br>Let me know if this works....<br>
 
<br>The DateOf is a column in a database and I'm using an Access Database.&nbsp;&nbsp;Wow help from the darkman, noticed you help a lot of people on here, very nice of you.&nbsp;&nbsp;I have played with it and this coding works.&nbsp;&nbsp;<br><br>Where&nbsp;&nbsp;datediff ('d',(Dateof),now())&gt;30<br><br>Thanks for your help and have a great Day.&nbsp;&nbsp;<br><br>I would let you know if it worked if I knew how, is there a way to email people that are members and say thanks, sorry new at this.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top