Search for Date/Time already scheduled

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default 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 & "&nbsp;&nbsp;" & rtimereq & "&nbsp;&nbsp;" &
    rendtime & "&nbsp;&nbsp;<-- 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") & "&nbsp;")
    : Response.Write("&nbsp;")
    : If RS.Fields("leave") = false Then
    : Response.Write(TimeWithoutSeconds(RS.Fields("timer eq")))
    : Response.Write("&nbsp;" &
    TimeWithoutSeconds(RS.Fields("endtime")) & "<br>")
    : Else
    : Response.Write("Theater Not Available.")
    : End If
    : End If
    : RS.MoveNext
    : WEnd
    :
    : End If
    :
    :
    : TIA.
    :


    Ken Schaefer Guest

  2. Similar Questions and Discussions

    1. 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...
    2. 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,...
    3. 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 >...
    4. 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...
  3. #2

    Default 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 & "&nbsp;&nbsp;" & rtimereq & "&nbsp;&nbsp;" &
    > rendtime & "&nbsp;&nbsp;<-- 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") & "&nbsp;")
    > : Response.Write("&nbsp;")
    > : If RS.Fields("leave") = false Then
    > : Response.Write(TimeWithoutSeconds(RS.Fields("timer eq")))
    > : Response.Write("&nbsp;" &
    > 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139