|
 |
access_asp thread: Is this another date problem?
Message #1 by "Ian Richardson" <ian@i...> on Thu, 15 Nov 2001 07:59:18 -0000
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_005D_01C16DAB.6D34DA20
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi
I did try to post this thro' the list but it wouldn't accept my post for
some reason.
I have tried to find a solution to my problem in the archives, but if it
exists, I can't finf it.
I wish to bring back results from Access 2000 where that lay between a
startdate and an enddate.
my sql and declarations for thsi are:
strEnd =3D Date()
strMonth =3D Month(Date)
strYear =3D Year(date)
strStart =3D "01/" & strMonth & "/" & strYear
strSQL =3D "Select VisitDate,Count(ReferringSite) as PageCount,
ReferringSite as URL"
strSQL =3D strSQL & " From stats"
strSQL =3D strSQL & " WHERE Site =3D '" & strSiteID & "' AND VisitDate
BETWEEN #" & strStart & "# AND #" & strEnd & "# "
I have checked to see if my inputs are dates by using:
varTest =3D CDate(strStart)
varTest1 =3D CDate(strEnd)
Response.write "Start =3D " & TypeName(varTest) & "<BR>"
Response.write "End =3D " & TypeName(varTest1
And
If isDate(strStart) then
strDate =3D CDate(strStart)
response.write "the isDate function result " & strdate
Else
response.write "this is not a date"
End If
Both of these test indicate a Date data type.
When I run the query I get the following error message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query
expression 'Site =3D 'desap' AND VisitDate BETWEEN ## AND ##'.
/at/process/stats.asp, line 318
I am running Server 2000 and Win 98 with the ssame results
Can anyone spot what my date error is? I have been at this for a whole
day now and I am becoming blood-nut with code-rage!!
Many thanks
Ian
Message #2 by "Ken Schaefer" <ken@a...> on Fri, 16 Nov 2001 10:58:08 +1100
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0085_01C16E8D.9376B900
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Do this please:
<%
' Stuff in blue is your code
' Stuff in red is my added code
strEnd =3D Date()
strMonth =3D Month(Date)
strYear =3D Year(date)
strStart =3D "01/" & strMonth & "/" & strYear
strSQL =3D "Select VisitDate,Count(ReferringSite) as PageCount,
ReferringSite as URL"
strSQL =3D strSQL & " From stats"
strSQL =3D strSQL & " WHERE Site =3D '" & strSiteID & "' AND VisitDate
BETWEEN #" & strStart & "# AND #" & strEnd & "# "
Response.Write(strSQL)
Response.End
%>
and post the output to the list
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ian Richardson" <ian@i...>
Subject: [access_asp] Is this another date problem?
Hi
I did try to post this thro' the list but it wouldn't accept my post for
some reason.
I have tried to find a solution to my problem in the archives, but if it
exists, I can't finf it.
I wish to bring back results from Access 2000 where that lay between a
startdate and an enddate.
my sql and declarations for thsi are:
strEnd =3D Date()
strMonth =3D Month(Date)
strYear =3D Year(date)
strStart =3D "01/" & strMonth & "/" & strYear
strSQL =3D "Select VisitDate,Count(ReferringSite) as PageCount,
ReferringSite as URL"
strSQL =3D strSQL & " From stats"
strSQL =3D strSQL & " WHERE Site =3D '" & strSiteID & "' AND VisitDate
BETWEEN #" & strStart & "# AND #" & strEnd & "# "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "Ian Richardson" <ian@i...> on Fri, 16 Nov 2001 06:47:09 -0000
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0040_01C16E6A.837ED280
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Ken,
the output is:
SELECT Count(ReferringSite) AS PageCount, ReferringSite as URL FROM
stats WHERE Site =3D ''desap" AND VisitDate BETWEEN # # AND # # "
This is what puzzles me as a my tests for a date return a date value but
it looks like the SQL is not seeing a date!
regards
ian
----- Original Message -----
From: Ken Schaefer
To: Access ASP
Sent: Thursday, November 15, 2001 11:58 PM
Subject: [access_asp] Re: Is this another date problem?
Do this please:
<%
' Stuff in blue is your code
' Stuff in red is my added code
strEnd =3D Date()
strMonth =3D Month(Date)
strYear =3D Year(date)
strStart =3D "01/" & strMonth & "/" & strYear
strSQL =3D "Select VisitDate,Count(ReferringSite) as PageCount,
ReferringSite as URL"
strSQL =3D strSQL & " From stats"
strSQL =3D strSQL & " WHERE Site =3D '" & strSiteID & "' AND VisitDate
BETWEEN #" & strStart & "# AND #" & strEnd & "# "
Response.Write(strSQL)
Response.End
%>
and post the output to the list
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ian Richardson" <ian@i...>
Subject: [access_asp] Is this another date problem?
Hi
I did try to post this thro' the list but it wouldn't accept my post
for some reason.
I have tried to find a solution to my problem in the archives, but if
it exists, I can't finf it.
I wish to bring back results from Access 2000 where that lay between a
startdate and an enddate.
my sql and declarations for thsi are:
strEnd =3D Date()
strMonth =3D Month(Date)
strYear =3D Year(date)
strStart =3D "01/" & strMonth & "/" & strYear
strSQL =3D "Select VisitDate,Count(ReferringSite) as PageCount,
ReferringSite as URL"
strSQL =3D strSQL & " From stats"
strSQL =3D strSQL & " WHERE Site =3D '" & strSiteID & "' AND VisitDate
BETWEEN #" & strStart & "# AND #" & strEnd & "# "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$subst('Email.Unsub')
Message #4 by "Ken Schaefer" <ken@a...> on Mon, 19 Nov 2001 11:13:49 +1100
|
|
Next, do you have Option Explicit as your second line of code?
<%@Language=VBScript%>
<% Option Explicit %>
?
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ian Richardson" <ian@i...>
Subject: [access_asp] Re: Is this another date problem?
Hi Ken,
the output is:
SELECT Count(ReferringSite) AS PageCount, ReferringSite as URL FROM stats
WHERE Site = ''desap" AND VisitDate BETWEEN # # AND # # "
This is what puzzles me as a my tests for a date return a date value but it
looks like the SQL is not seeing a date!
regards
ian
Message #5 by "Ian Richardson" <ian@i...> on Mon, 19 Nov 2001 07:05:32 -0000
|
|
No, it's commented out
----- Original Message -----
From: "Ken Schaefer" <ken@a...>
To: "Access ASP" <access_asp@p...>
Sent: Monday, November 19, 2001 12:13 AM
Subject: [access_asp] Re: Is this another date problem?
> Next, do you have Option Explicit as your second line of code?
> <%@Language=VBScript%>
> <% Option Explicit %>
> ?
>
> Cheers
> Ken
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "Ian Richardson" <ian@i...>
> Subject: [access_asp] Re: Is this another date problem?
>
>
> Hi Ken,
> the output is:
> SELECT Count(ReferringSite) AS PageCount, ReferringSite as URL FROM stats
> WHERE Site = ''desap" AND VisitDate BETWEEN # # AND # # "
>
> This is what puzzles me as a my tests for a date return a date value but
it
> looks like the SQL is not seeing a date!
>
> regards
>
> ian
>
>
>
>
>
Message #6 by "Ken Schaefer" <ken@a...> on Tue, 20 Nov 2001 11:18:38 +1100
|
|
Please put Option Explicit in.
Possibly a typo is causing a problem...
Always use Option Explicit - it is just about the number 1 logical-problem
troubleshooting tool.
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Ian Richardson" <ian@i...>
Subject: [access_asp] Re: Is this another date problem?
: No, it's commented out
:
: ----- Original Message -----
: From: "Ken Schaefer" <ken@a...>
: To: "Access ASP" <access_asp@p...>
: Sent: Monday, November 19, 2001 12:13 AM
: Subject: [access_asp] Re: Is this another date problem?
:
:
: > Next, do you have Option Explicit as your second line of code?
: > <%@Language=VBScript%>
: > <% Option Explicit %>
: > ?
: >
: > Cheers
: > Ken
: >
: > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: > From: "Ian Richardson" <ian@i...>
: > Subject: [access_asp] Re: Is this another date problem?
: >
: >
: > Hi Ken,
: > the output is:
: > SELECT Count(ReferringSite) AS PageCount, ReferringSite as URL FROM
stats
: > WHERE Site = ''desap" AND VisitDate BETWEEN # # AND # # "
: >
: > This is what puzzles me as a my tests for a date return a date value but
: it
: > looks like the SQL is not seeing a date!
: >
: > regards
: >
: > ian
: >
: >
: >
: >
$subst('Email.Unsub')
: >
:
:
|
|
 |