Ask a Question related to ASP Database, Design and Development.
-
Ken Schaefer #1
Re: Search for Date/Time already scheduled
This line:
If rtimereq BETWEEN #timereq# AND #endtime# Then
is not valid VBScript
If rtimereq < timereq And rtimereq > endtime Then
...
End If
would be an example of valid VBScript
Cheers
Ken
"tonya" <anonymous@discussions.microsoft.com> wrote in message
news:A737231A-6515-4EE3-AAC5-552316287609@microsoft.com...
: I have a form that posts events to a calendar. The pages include form.asp
and insert.asp.
:
: form.asp just includes (to keep it simple) 3 dropdown boxes for the date
(M/D/Y) and 3 each for the start time and end time (H / M / (AM/PM)).
:
: I want to be able to check to see if the time is already taken and to send
the user back to the form.asp page. I'm having trouble with the If
statement within the Record Set loop. It keeps giving me an error saying
"expected Then statement" which leaves me to believe that my If stmt is
wrong (If rtimereq BETWEEN #timereq# AND #endtime# Then).
:
: The db is Access 2002 and the fields are Date/Time, Format=Medium Time for
both timereq and endtime (db fields). I'm thinking that the BETWEEN
statement isn't working because the date is being read into as a string ???
Any suggestions are greatly appreciated.
:
: Below is code for insert.asp.
:
: smonth = Request.Form("smonth")
: sday = Request.Form("sday")
: syear = Request.Form("syear")
: rdatereq = smonth & "/" & sday & "/" & syear
:
: starthour = Request.Form("starthour")
: startmin = Request.Form("startmin")
: starthalf = Request.Form("starthalf")
:
: endhour = Request.Form("endhour")
: endmin = Request.Form("endmin")
: endhalf = Request.Form("endhalf")
:
: rtimereq = starthour & ":" & startmin & " " & starthalf
: rendtime = endhour & ":" & endmin & " " & endhalf
:
: The above will get the data from the form.
:
: ' Below is the code to check to see if the record exists (wherein lies
the problem)
:
: tdate = rdatereq
:
: Dim RS
:
: SQL = "SELECT datereq, leave, timereq, endtime FROM truck " & _
: "WHERE datereq BETWEEN #" & tdate & "# AND #" & _
: tDate & "# "
:
: Response.Write(rdatereq & " " & rtimereq & " " &
rendtime & " <-- This is the entered time and date" & "<br><br>")
:
: If RS.EOF then
:
: Response.Write ("No events scheduled.")
:
: Else
:
: Response.Write ("Below are the times scheduled for: " & tdate &
"<br><br>")
:
: While not RS.EOF
: If rtimereq BETWEEN #timereq# AND #endtime# Then
: Response.Write("The start time is unavailable!")
: Else
: Response.Write(RS.Fields("datereq") & " ")
: Response.Write(" ")
: If RS.Fields("leave") = false Then
: Response.Write(TimeWithoutSeconds(RS.Fields("timer eq")))
: Response.Write(" " &
TimeWithoutSeconds(RS.Fields("endtime")) & "<br>")
: Else
: Response.Write("Theater Not Available.")
: End If
: End If
: RS.MoveNext
: WEnd
:
: End If
:
:
: TIA.
:
Ken Schaefer Guest
-
scheduled task ignores start/end time
hello everybody since we restart a server each morning there is a problem with scheduled tasks. they will be activated after restart and are... -
Scheduled Task Windows showing old time
We run CF MX 7.0 multi-server config. on Windows 2003. We scheduled a task to run daily at 02:30 and it has been running for months. Last month,... -
CFMX7.0.1 Administrator date time issue showing 13hrsbehind server time
I am running a W2k SP4 box that has been upgraded from CFMX6 to CFMX7.0.1. The CFMX7.0.1 server is showing the date on the Server Settings >... -
Scheduled Task run 1 hour after time is programming
Hi, I'm running CFMX 6.1 on a WIN2000 Server as application Server. Because one of our big applications we had to set several scheduled task in... -
Convert date/time to date in SQL Server 2000 statement
Can this be done? tia -
Aaron Bertrand [MVP] #2
Re: Search for Date/Time already scheduled
Or maybe...
If rtimereq >= timereq and rtimereq <= endtime then
;-)
--
Aaron Bertrand
SQL Server MVP
[url]http://www.aspfaq.com/[/url]
"Ken Schaefer" <kenREMOVE@THISadOpenStatic.com> wrote in message
news:%23MHX9gRIEHA.364@TK2MSFTNGP11.phx.gbl...> This line:
>
> If rtimereq BETWEEN #timereq# AND #endtime# Then
>
> is not valid VBScript
>
> If rtimereq < timereq And rtimereq > endtime Then
> ...
> End If
>
> would be an example of valid VBScript
>
> Cheers
> Ken
>
>
> "tonya" <anonymous@discussions.microsoft.com> wrote in message
> news:A737231A-6515-4EE3-AAC5-552316287609@microsoft.com...
> : I have a form that posts events to a calendar. The pages include
> form.asp
> and insert.asp.
> :
> : form.asp just includes (to keep it simple) 3 dropdown boxes for the date
> (M/D/Y) and 3 each for the start time and end time (H / M / (AM/PM)).
> :
> : I want to be able to check to see if the time is already taken and to
> send
> the user back to the form.asp page. I'm having trouble with the If
> statement within the Record Set loop. It keeps giving me an error saying
> "expected Then statement" which leaves me to believe that my If stmt is
> wrong (If rtimereq BETWEEN #timereq# AND #endtime# Then).
> :
> : The db is Access 2002 and the fields are Date/Time, Format=Medium Time
> for
> both timereq and endtime (db fields). I'm thinking that the BETWEEN
> statement isn't working because the date is being read into as a string
> ???
> Any suggestions are greatly appreciated.
> :
> : Below is code for insert.asp.
> :
> : smonth = Request.Form("smonth")
> : sday = Request.Form("sday")
> : syear = Request.Form("syear")
> : rdatereq = smonth & "/" & sday & "/" & syear
> :
> : starthour = Request.Form("starthour")
> : startmin = Request.Form("startmin")
> : starthalf = Request.Form("starthalf")
> :
> : endhour = Request.Form("endhour")
> : endmin = Request.Form("endmin")
> : endhalf = Request.Form("endhalf")
> :
> : rtimereq = starthour & ":" & startmin & " " & starthalf
> : rendtime = endhour & ":" & endmin & " " & endhalf
> :
> : The above will get the data from the form.
> :
> : ' Below is the code to check to see if the record exists (wherein lies
> the problem)
> :
> : tdate = rdatereq
> :
> : Dim RS
> :
> : SQL = "SELECT datereq, leave, timereq, endtime FROM truck " & _
> : "WHERE datereq BETWEEN #" & tdate & "# AND #" & _
> : tDate & "# "
> :
> : Response.Write(rdatereq & " " & rtimereq & " " &
> rendtime & " <-- This is the entered time and date" &
> "<br><br>")
> :
> : If RS.EOF then
> :
> : Response.Write ("No events scheduled.")
> :
> : Else
> :
> : Response.Write ("Below are the times scheduled for: " & tdate &
> "<br><br>")
> :
> : While not RS.EOF
> : If rtimereq BETWEEN #timereq# AND #endtime# Then
> : Response.Write("The start time is unavailable!")
> : Else
> : Response.Write(RS.Fields("datereq") & " ")
> : Response.Write(" ")
> : If RS.Fields("leave") = false Then
> : Response.Write(TimeWithoutSeconds(RS.Fields("timer eq")))
> : Response.Write(" " &
> TimeWithoutSeconds(RS.Fields("endtime")) & "<br>")
> : Else
> : Response.Write("Theater Not Available.")
> : End If
> : End If
> : RS.MoveNext
> : WEnd
> :
> : End If
> :
> :
> : TIA.
> :
>
>
Aaron Bertrand [MVP] Guest



Reply With Quote

