I have been working on this for two weeks now and I am very frustrated!!! Here is what I am trying to do:
A person wants to reserve a monitor. In my database I have Date_Out and Date_Return fields. The user selects the dates he wants to reserve the monitor (Date1 = the date he would like to take out the monitor and Date2 = the date he would be returning the monitor. If the dates (date1 and date2) he selected are within the period of Date_Out and Date_Return, then he is prompted with the msg that the dates he selected for the monitor are not available. If the monitor is available then do a INSERT query into Table1
varDate1 = #03/04/2005#
varDate2 = #03/04/2005#
sqltext = "SELECT Table1.SerialNo, Table1.Date_Out, Table1.Date_Return FROM Table1 WHERE Table1.SerialNo='" & varSerialNo & "' AND (Table1.Date_Out >= #" & varDate1 & "# And Table1.Date_Out <= #" & varDate1 & "#) OR (Table1.Date_Out >= #" & varDate2 & "# And Table1.Date_Out <= #" & varDate2 & "#)"
rs.open sqltext,conn
if not rs.eof then
Response.Write "The monitor is not available!"
else
Response.Write "The monitor is available!"
end if
A person wants to reserve a monitor. In my database I have Date_Out and Date_Return fields. The user selects the dates he wants to reserve the monitor (Date1 = the date he would like to take out the monitor and Date2 = the date he would be returning the monitor. If the dates (date1 and date2) he selected are within the period of Date_Out and Date_Return, then he is prompted with the msg that the dates he selected for the monitor are not available. If the monitor is available then do a INSERT query into Table1
varDate1 = #03/04/2005#
varDate2 = #03/04/2005#
sqltext = "SELECT Table1.SerialNo, Table1.Date_Out, Table1.Date_Return FROM Table1 WHERE Table1.SerialNo='" & varSerialNo & "' AND (Table1.Date_Out >= #" & varDate1 & "# And Table1.Date_Out <= #" & varDate1 & "#) OR (Table1.Date_Out >= #" & varDate2 & "# And Table1.Date_Out <= #" & varDate2 & "#)"
rs.open sqltext,conn
if not rs.eof then
Response.Write "The monitor is not available!"
else
Response.Write "The monitor is available!"
end if