I am running the following in an ASP page and it works perfectly:
<%
dim Rdate
dim PrevRdate
Set conn = server.createobject("adodb.connection")
conn.connectionstring = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\tradersreportsdata\reportevents.mdb;pwd=matrix"
conn.Open
Set rs=Server.CreateObject("ADODB.recordset")
rs.open "SELECT FORMAT(rTime ,'h:nnam/pm') as fTime,rDate,rName FROM reports WHERE (((Format(rDate,'yyyy-ww'))=Format(Date(),'yyyy-ww')));", conn
do until rs.EOF
Rdate = rs("rDate")
response.write (Rdate & rs("rName") & rs("fTime") &"<BR>")
rs.movenext
loop
rs.close
conn.close
Set conn = Nothing
%>
I want the Rdate value to be set to nothing, and not the value from the query, if the current record has the same value as the previous record's value, so I changed:
Rdate = rs("rDate")
to:
PrevRdate = Rdate
If PrevRdate <> rs("rDate") Then
Rdate = rs("rDate")
Else
Rdate = ""
so that the new code is:
<%
dim Rdate
dim PrevRdate
Set conn = server.createobject("adodb.connection")
conn.connectionstring = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\tradersreportsdata\reportevents.mdb;pwd=matrix"
conn.Open
Set rs=Server.CreateObject("ADODB.recordset")
rs.open "SELECT FORMAT(rTime ,'h:nnam/pm') as fTime,rDate,rName FROM reports WHERE (((Format(rDate,'yyyy-ww'))=Format(Date(),'yyyy-ww')));", conn
do until rs.EOF
Rdate = rs("rDate")
response.write (Rdate & rs("rName") & rs("fTime") &"<BR>")
Move to the Next Record in the database
rs.movenext
loop
rs.close
conn.close
Set conn = Nothing
%>
This returns 'loop' without 'do'.
Can anyone tell me what I'm doing wrong?
<%
dim Rdate
dim PrevRdate
Set conn = server.createobject("adodb.connection")
conn.connectionstring = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\tradersreportsdata\reportevents.mdb;pwd=matrix"
conn.Open
Set rs=Server.CreateObject("ADODB.recordset")
rs.open "SELECT FORMAT(rTime ,'h:nnam/pm') as fTime,rDate,rName FROM reports WHERE (((Format(rDate,'yyyy-ww'))=Format(Date(),'yyyy-ww')));", conn
do until rs.EOF
Rdate = rs("rDate")
response.write (Rdate & rs("rName") & rs("fTime") &"<BR>")
rs.movenext
loop
rs.close
conn.close
Set conn = Nothing
%>
I want the Rdate value to be set to nothing, and not the value from the query, if the current record has the same value as the previous record's value, so I changed:
Rdate = rs("rDate")
to:
PrevRdate = Rdate
If PrevRdate <> rs("rDate") Then
Rdate = rs("rDate")
Else
Rdate = ""
so that the new code is:
<%
dim Rdate
dim PrevRdate
Set conn = server.createobject("adodb.connection")
conn.connectionstring = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\tradersreportsdata\reportevents.mdb;pwd=matrix"
conn.Open
Set rs=Server.CreateObject("ADODB.recordset")
rs.open "SELECT FORMAT(rTime ,'h:nnam/pm') as fTime,rDate,rName FROM reports WHERE (((Format(rDate,'yyyy-ww'))=Format(Date(),'yyyy-ww')));", conn
do until rs.EOF
Rdate = rs("rDate")
response.write (Rdate & rs("rName") & rs("fTime") &"<BR>")
Move to the Next Record in the database
rs.movenext
loop
rs.close
conn.close
Set conn = Nothing
%>
This returns 'loop' without 'do'.
Can anyone tell me what I'm doing wrong?