Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Times

Status
Not open for further replies.

anastasia

Programmer
Dec 13, 2000
111
GB
Hi, I am trying to use an iF statment to check in a database if a time has been booked and if so a message is returned yes it sounds easy but the catch is this.

A user enters a booking time in a form this time is then used to check the times already entered in the database. I already have an IF statement that compares matching times, however if their is also a time(s) that are only less than the time entered by the user by 15 mins or greater than the time by adding 15 mins then a booking cannot be made as booking can only be made if they are 15 mins apart either way.

The code I have so far is thus.

<% IF mytime BETWEEN (RS(&quot;bookingtime&quot;)-15 AND RS(&quot;bookingtime&quot;)+15) THEN %>
<% errorForm &quot;Booking time taken&quot; %>
<% END IF %>

I get an error on this statement I don't think it likes the BETWEEN function.

Any ideas would be welcome.
Thanks.
 
Try this:

if not (my time < rs(&quot;bookingtime&quot;)-15 or mytime > rs(&quot;bookingtime&quot;) ) then


also, you can't just add and subtract time like that if you are using date objects. I'm not sure what you are using though, integers will do that fine. Date objects you need to use the DateAdd function with a negative amount.

Hope that helps

Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top