holty
01-09-2003, 06:58 PM
Hi,
I have a problem!
I have a table in access which contains advert information. There is a field named date (when the advert was added).
On my asp page i would like to show all adverts that appeared in the last 14 days.
I realise that:
Date() - will show the current date - 08/01/03
Date()-14 - will show current date minus 14 - 26/12/02.
However in my asp page it shows advetrs taht have been added on the 10/12/02. Anyone had this problem before?
Here's my code
If rsAdvertDetails("Date") > Date()-14 then
Do While not rsAdvertDetails.EOF
%>
<center>
<table border="1" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td width="100%" bgcolor="#5E6D95" class="heading" colspan="2">
<b>» Current Advert Information for <%=request.cookies("Username")%></b></td>
</tr>
<tr>
<td width="25%" class="middle"><b>Model: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("VWModelDescription")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Model type: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("VWModelTypeDescription")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Description: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("Description")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Year: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("Year")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Image: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("Image")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Price: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("Price")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Date: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("Date")%> </td>
</tr>
<tr>
<td width="100%" class="middle" colspan="2"><center><form method="POST" action="updateadvert.asp?advertID=<%=rsAdvertDetails("AdvertID")%>">
<INPUT TYPE=SUBMIT NAME="cmdLogout" VALUE="Revise this advert"></center>
</form>
</table>
<br>
</center>
<%
'Move to the next record in the recordset
rsAdvertDetails.MoveNext
Loop
%>
<% end if %>
I have a problem!
I have a table in access which contains advert information. There is a field named date (when the advert was added).
On my asp page i would like to show all adverts that appeared in the last 14 days.
I realise that:
Date() - will show the current date - 08/01/03
Date()-14 - will show current date minus 14 - 26/12/02.
However in my asp page it shows advetrs taht have been added on the 10/12/02. Anyone had this problem before?
Here's my code
If rsAdvertDetails("Date") > Date()-14 then
Do While not rsAdvertDetails.EOF
%>
<center>
<table border="1" cellpadding="0" cellspacing="0" width="95%">
<tr>
<td width="100%" bgcolor="#5E6D95" class="heading" colspan="2">
<b>» Current Advert Information for <%=request.cookies("Username")%></b></td>
</tr>
<tr>
<td width="25%" class="middle"><b>Model: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("VWModelDescription")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Model type: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("VWModelTypeDescription")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Description: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("Description")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Year: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("Year")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Image: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("Image")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Price: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("Price")%> </td>
</tr>
<tr>
<td width="25%" class="middle"><b>Date: </b></font> </td>
<td width="75%" class="middle"><%=rsAdvertDetails("Date")%> </td>
</tr>
<tr>
<td width="100%" class="middle" colspan="2"><center><form method="POST" action="updateadvert.asp?advertID=<%=rsAdvertDetails("AdvertID")%>">
<INPUT TYPE=SUBMIT NAME="cmdLogout" VALUE="Revise this advert"></center>
</form>
</table>
<br>
</center>
<%
'Move to the next record in the recordset
rsAdvertDetails.MoveNext
Loop
%>
<% end if %>