Web Analytics Made Easy -
StatCounter Microsoft VBScript compilation (0x800A03EA) - CodingForum

Announcement

Collapse
No announcement yet.

Microsoft VBScript compilation (0x800A03EA)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Microsoft VBScript compilation (0x800A03EA)

    this is my error that i get..
    Microsoft VBScript compilation (0x800A03EA)
    Syntax error
    /e-training/DailyRpt.asp, line 175, column 47
    else if (month(rs7("CourseDateStart"))>= 4 AND <=6) then

    and this is my coding..
    <%

    sql = "SELECT * from Training WHERE StaffName='" & rs2("StaffName") & "' AND Company='TSB'"
    SET RS7 = Conn.Execute(sql)
    Do While not RS7.EOF

    %>
    <% if ((month(rs7("CourseDateStart"))) => 1 and (month(rs("CourseDateStart"))) <=3) then response.Write("Q1")%><br>
    <%else if (month(rs7("CourseDateStart"))>= 4 AND <=6) then
    response.Write("Q2")%><br>
    <%else if (month(rs7("CourseDateStart"))>= 7 AND <=9) then
    response.Write("Q3")%><br>
    <%else if (month(rs7("CourseDateStart")) >=10 AND <=12) then
    response.Write("Q4")%><br>
    <%end if%><%end if%><%end if%>

    <%rs7.MoveNext
    loop
    rs7.Close
    set rs7 = Nothing
    %>
    can onyone help me..
    please!!!!

  • #2
    Your If statements are incorrect. When you use a logical operator (AND, OR, etc.), you must set it up like so:
    Code:
    If(test [comparison operator] value [logical operator] test2 [comparison operator] value2) Then
    Which would yield something like:
    Code:
    If(day > 31 And month = 12) Then
    So your ElseIf statements like this one here:
    Code:
    else if (month(rs7("CourseDateStart"))>= 4 AND <=6) then
    Should be set up like your first If statement:
    Code:
    if ((month(rs7("CourseDateStart"))) => 1 and (month(rs("CourseDateStart"))) <=3)
    So the corrected version would look like this:
    Code:
    else if (month(rs7("CourseDateStart"))>= 4 AND month(rs7("CourseDateStart"))<=6) then
    Do this for your other two ElseIf statements.

    -Shane

    Comment


    • #3
      As a minor point:

      Usually, you should avoid getting a value from any collection more than once, because collection lookups are a lot slower than other things in VBScript. Yes, that includes looking up the value of a recordset field.

      So, *IF* you can easily do so:
      Code:
      <%
      courseStart = rs7("CourseDateStart")
      monthCourseStart = Month(courseStart)
      ...
      If ...
      
      Elseif monthCourseStart >= 4 AND monthCourseStart <= 6 Then
      ...
      ALSO... MAJOR MISTAKE IN THE CODE!

      ELSEIF should be ALL ONE WORD! No paces!

      If you code it as two words, then you have to have an END IF for each IF.

      Only if you do it as one word can you "chain" a bunch of ELSEIF statements as you are doing.
      Be yourself. No one else is as qualified.

      Comment

      Working...
      X