Question
Can anybody help? (originally posted in macromedia.dreamweaver)
Hi Guys and Gals,
I need some help determining a problem with some code I'm attempting to use.
It's probably something obvious that I'm missing... what I'm trying to achieve is this
* - Has the user submitted any previous offers?
* - If they HAVE, was their most recent offer submitted in the last 24 hours?
* - If their most recent offer was submitted in the last 24 hours then redirect the user to the page "Error.asp"
* - If the user HAS NOT submitted an offer in the last 24 hours OR their most recent offer was submitted MORE than 24 hours ago,
allow the rest of this page to load and a new offer to be submitted.
This is the actual code I'm using:
<%
If Rs_ExistingOffers.EOF And Rs_ExistingOffers.BOF Then
'If There are NO Existing Offers
'Do nothing and let the page load.
Else
If Not Rs_ExistingOffers.EOF Or Not Rs_ExistingOffers.BOF Then
'If there ARE existing offers, now we check to see if any of
'them are from within the last 24 hours
HoursSinceLastQuote = DateDiff("h",(Rs_ExistingOffers.Fields.Item("DateOfOffer").Value),Now())
'If the most recent previous offer was within the last 24
'hours, prevent a further offer from being submitted.
If (HoursSinceLastQuote) < 24 Then
Response.Redirect("Error.asp")
End If
End if
End If
%>
Unfortunately, whether there is an existing offer in the database or not, the page redirects to "Error.asp" regardless.
FYI, the recordset "Rs_ExistingOffers" is being filtered by way of the Customer ID (CusID) (which is a by-product of the customer's
Username and Session("MM_Username") filtering the database of users for authentication), and then ordering any records it finds in
Rs_ExistingOffers that
match the CusID in decending order (I.e. most recent first).
Please, can anyone see what it is that I'm doing wrong?
Regards
DTBK
I need some help determining a problem with some code I'm attempting to use.
It's probably something obvious that I'm missing... what I'm trying to achieve is this
* - Has the user submitted any previous offers?
* - If they HAVE, was their most recent offer submitted in the last 24 hours?
* - If their most recent offer was submitted in the last 24 hours then redirect the user to the page "Error.asp"
* - If the user HAS NOT submitted an offer in the last 24 hours OR their most recent offer was submitted MORE than 24 hours ago,
allow the rest of this page to load and a new offer to be submitted.
This is the actual code I'm using:
<%
If Rs_ExistingOffers.EOF And Rs_ExistingOffers.BOF Then
'If There are NO Existing Offers
'Do nothing and let the page load.
Else
If Not Rs_ExistingOffers.EOF Or Not Rs_ExistingOffers.BOF Then
'If there ARE existing offers, now we check to see if any of
'them are from within the last 24 hours
HoursSinceLastQuote = DateDiff("h",(Rs_ExistingOffers.Fields.Item("DateOfOffer").Value),Now())
'If the most recent previous offer was within the last 24
'hours, prevent a further offer from being submitted.
If (HoursSinceLastQuote) < 24 Then
Response.Redirect("Error.asp")
End If
End if
End If
%>
Unfortunately, whether there is an existing offer in the database or not, the page redirects to "Error.asp" regardless.
FYI, the recordset "Rs_ExistingOffers" is being filtered by way of the Customer ID (CusID) (which is a by-product of the customer's
Username and Session("MM_Username") filtering the database of users for authentication), and then ordering any records it finds in
Rs_ExistingOffers that
match the CusID in decending order (I.e. most recent first).
Please, can anyone see what it is that I'm doing wrong?
Regards
DTBK
