Skip to main content
Participant
February 14, 2007
Question

Query Causes ASP Error

  • February 14, 2007
  • 2 replies
  • 382 views
This query works great within MS Access itself but causes and error when used in an ASP application ...
DateAdd("m",-2,EndDate()) >= Date()

Someone suggested there is a problem with the quote marks in ASP. Would appreciate any help to resolve this. The original thread is below. Thanks.

Newsgroup User has posted a message entitled Re: EndDate.

Message Posted on: Monday January 22,2007 05:01:27 PM
You use a DateAdd function to get this, something like

DateAdd("m",-2,EndDate()) >= Date()

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"Tiggerick" <webforumsuser@macromedia.com> wrote in message
news:ep2nej$oar$1@forums.macromedia.com...
> Our current function is ... EndDate() >= Date() ... which is used to
> screen out
> any results prior to today's date.
> We would like to modify this so that instead of today's date we would use
> the
> date 2 months prior to today's date, so that, for example the EndDate() on
> 1/22/07 would be 11/22/06.
> Would appreciate help on the format for this.
> Thanks in advance!
> Rick
>




You can view the message at http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=189&threadid=1235135&forumid=12.

Text quote marks Text
This topic has been closed for replies.

2 replies

Inspiring
February 14, 2007
The quotes around m are the problem here. Double them up to send as-is to
Access (""m"" instead of "m").

"Tiggerick" <webforumsuser@macromedia.com> wrote in message
news:er00oi$duu$1@forums.macromedia.com...
> Here is the complete SQL statement that is causing a problem. Dreamweaver
> is
> showing the m inside the quotes in black if that means anything ...
>
> Recordset1.Source = "SELECT * FROM Events WHERE EventType = '" +
> Replace(Recordset1__MMColParam, "'", "''") + "' AND EndDate >=
> DateAdd("m", -2,
> Date()) ORDER BY StartDate ASC"
>


TiggerikAuthor
Participant
February 14, 2007
Here is the complete SQL statement that is causing a problem. Dreamweaver is showing the m inside the quotes in black if that means anything ...

Recordset1.Source = "SELECT * FROM Events WHERE EventType = '" + Replace(Recordset1__MMColParam, "'", "''") + "' AND EndDate >= DateAdd("m", -2, Date()) ORDER BY StartDate ASC"