Hi I have the following code: The problem with the code is that when this code is implemented as shown below then the error message in the code below booking time entered is invalid always displayed when it shouldnt, however if I take out the above code comparing bookingdate and bookingtime then the other code works fine and vise versa. I was wondering if it was anything to do with having two loops the code is within a query which extracts data froma database. Any ideas welcome.
<%Do while NOT RS.EOF%>
<% IF RS("BookingDate" = bookdate AND RS("BookingTime" = time THEN %>
<% errorForm "The Date and Time entered is already Booked." %>
<% END IF %>
<% RS.MoveNext%>
<%Loop%>
<%
dim found
found = false
Do while NOT RS.EOF
IF RS("Times" = time THEN
found = true
end if
RS.MoveNext
Loop
if not found then
errorForm "Booking Time entered Invalid."
end if
%>
<%RS.Close%>
<%Do while NOT RS.EOF%>
<% IF RS("BookingDate" = bookdate AND RS("BookingTime" = time THEN %>
<% errorForm "The Date and Time entered is already Booked." %>
<% END IF %>
<% RS.MoveNext%>
<%Loop%>
<%
dim found
found = false
Do while NOT RS.EOF
IF RS("Times" = time THEN
found = true
end if
RS.MoveNext
Loop
if not found then
errorForm "Booking Time entered Invalid."
end if
%>
<%RS.Close%>