Microsoft VBScript compilation error '800a0400'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • md9108
    New Member
    • Sep 2007
    • 9

    Microsoft VBScript compilation error '800a0400'

    I created, using some borrowed code, an asp search page for our intranet. I'm using frontpage 2003. When I publish I get that complation error on different lines at different times. They all seem to do with end if and elseif statements. The last one is from line 118. I highligted it. The code below is:
    [code=asp]<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
    <HTML>
    <HEAD>

    <SCRIPT LANGUAGE="VBScr ipt" RUNAT="Server">
    <!--
    option explicit
    -->
    </SCRIPT>

    <TITLE>Index Server Search Form</TITLE>

    <META NAME="DESCRIPTI ON" CONTENT="Sample ASP query form for
    Microsoft Index Server">
    <META NAME="KEYWORDS" CONTENT="query, content, hit, asp">
    <META NAME="MS.LOCALE " CONTENT="EN-US">
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
    charset=Windows-1252">
    <%
    NewQuery = FALSE
    UseSavedQuery = FALSE
    QueryForm = Request.ServerV ariables( "PATH_INFO" )
    SearchString = ""
    if Request.ServerV ariables("REQUE ST_METHOD") = "POST" then
    SearchString = Request.Form("S earchString")
    pg = Request.Form("p g")

    if pg <> "" then
    NextPageNumber = pg
    NewQuery = FALSE
    UseSavedQuery = TRUE
    else
    NewQuery = SearchString <> ""
    end if
    end if

    %>
    </HEAD>
    <meta name="Microsoft Border" content="t">
    <TABLE>
    <TR>
    <TD><H1>LFG Search Form</H1></TD>
    </TR>
    </TABLE>

    <HR WIDTH=75% ALIGN=center SIZE=3>
    <p>

    <TABLE>
    <TR>
    <TD ALIGN=LEFT>Ente r your query below:</TD>
    </TR>
    <TR>
    <TD>
    <FORM ACTION="<%= QueryForm%>" METHOD=POST>

    <TABLE>
    <TR>
    <TD><INPUT TYPE="TEXT" NAME="SearchStr ing" SIZE="60"
    MAXLENGTH="100" VALUE="<%=Searc hString%>"></TD>
    <TD><INPUT TYPE="SUBMIT" NAME="Action" VALUE="New Query"></TD>
    </TR>
    </TABLE>

    </FORM>
    </TD>
    </TR>
    </TABLE>
    <BR>

    <%

    if SearchString <> "" then
    if NewQuery then
    set Session("Query" ) = nothing
    set Session("Record set") = nothing
    NextRecordNumbe r = 1

    set Q = Server.CreateOb ject("ixsso.Que ry")
    set util = Server.CreateOb ject("ixsso.uti l")
    Q.Query = SearchString
    Q.SortBy = "rank[d]"
    Q.Columns = "DocTitle, vpath, path, filename, size, write, characterizatio n"
    util.AddScopeTo Query Q, ""

    set RS = Q.CreateRecordS et("nonsequenti al")

    RS.PageSize = 10
    ActiveQuery = TRUE

    elseif UseSavedQuery then
    if IsObject( Session("Query" ) ) And IsObject( Session("Record Set") ) then
    set Q = Session("Query" )
    set RS = Session("Record Set")
    *********(line1 18) if RS.RecordCount <> -1 and NextPageNumber <> -1 *******then RS.AbsolutePage = NextPageNumber
    NextRecordNumbe r = RS.AbsolutePosi tion
    end if

    ActiveQuery = TRUE
    else
    Response.Write "ERROR - No saved query"
    end if
    end if
    %>
    <p>
    <HR width="80%" ALIGN=center SIZE=3>
    <p>

    <%
    LastRecordOnPag e = NextRecordNumbe r + RS.PageSize - 1
    CurrentPage = RS.AbsolutePage
    if RS.RecordCount <> -1 AND RS.RecordCount < LastRecordOnPag e then
    LastRecordOnPag e = RS.RecordCount
    end if

    Response.Write "Documents " & NextRecordNumbe r & " to " & LastRecordOnPag e
    if RS.RecordCount <> -1 then
    Response.Write " of " & RS.RecordCount
    end if
    Response.Write " matching the query " & chr(34) & "<I>"
    Response.Write SearchString & "</I>" & chr(34) & ".<P>"
    %>
    <dl>

    <!-- BEGIN first row of query results table -->
    <% Do While Not RS.EOF and NextRecordNumbe r <= LastRecordOnPag e %>

    <%
    ' This is the detail portion for Title, Abstract, URL, Size, and
    ' Modification Date.

    ' If there is a title, display it, otherwise display the virtual path.
    %>
    <p>
    <dt><%= NextRecordNumbe r%>.
    <%if VarType(RS("Doc Title")) = 1 or RS("DocTitle") = "" then%>
    <b><a href="<%=RS("vp ath")%>"><%= Server.HTMLEnco de( RS("filename") )%></a></b>
    <%else%>
    <b><a href="<%=RS("vp ath")%>"><%= Server.HTMLEnco de(RS("DocTitle "))%></a></b>
    <%end if%>
    <dd>
    <%if VarType(RS("cha racterization") ) = 8 and RS("characteriz ation") <> "" then%>
    <b><i>Abstrac t: </I></b><%= Server.HTMLEnco de(RS("characte rization"))%>
    <br>
    <%end if%>
    <cite>
    <a href="http://lf04/">http://LF04</a>
    <font size=-1> - <%if RS("size") = "" then%>(size and time unknown)<%else% >size <%=RS("size") %> bytes - <%=RS("write")% > GMT<%end if%></font>
    </cite>

    <%
    RS.MoveNext
    NextRecordNumbe r = NextRecordNumbe r+1
    Loop
    %>

    </dl>
    <P><BR>

    <%
    else ' NOT RS.EOF
    if NextRecordNumbe r = 1 then
    Response.Write "No documents matched the query<P>"
    else
    Response.Write "No more documents in the query<P>"
    end if

    end if ' NOT RS.EOF
    %>

    <!-- If the index is out of date, display the fact -->

    <%if Q.OutOfDate then%>
    <P>
    <I><B>The index is out of date.</B></I><BR>
    <%end if%>

    <!--
    If the query was not executed because it needed to enumerate to
    resolve the query instead of using the index, but AllowEnumeratio n
    was FALSE, let the user know
    -->

    <%if Q.QueryIncomple te then%>
    <P>
    <I><B>The query is too expensive to complete.</B></I><BR>
    <%end if%>

    <!--
    If the query took too long to execute (for example, if too much work
    was required to resolve the query), let the user know
    -->

    <%if Q.QueryTimedOut then%>
    <P>
    <I><B>The query took too long to complete.</B></I><BR>
    <%end if%>
    <TABLE>

    <!--
    This is the "previous" button.
    This retrieves the previous page of documents for the query.
    -->

    <%SaveQuery = FALSE%>
    <%if CurrentPage > 1 and RS.RecordCount <> -1 then%>
    <td align=left>
    <form action="<%= QueryForm%><INP UT TYPE="HIDDEN" NAME="SearchStr ing" VALUE="<%=Searc hString%>"><INP UT TYPE="HIDDEN" name="pg" VALUE="<%=Curre ntPage-1%>" ><input type="submit" value="Previous <%=RS.PageSize% > documents">
    </form>
    </td>
    <%SaveQuery = TRUE%>
    <%end if%>

    <!--
    This is the "next" button.
    This button retrieves the next page of documents for the query.
    If the RS.RecordCount is available, the number of
    documents on the next page will be displayed.
    -->

    <%if Not RS.EOF then%>
    <td align=right>
    <form action="<%= QueryForm%>" method="POST">
    <INPUT TYPE="HIDDEN" NAME="SearchStr ing" VALUE="<%=Searc hString%>">
    <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=Curre ntPage+1%>" >

    <% NextString = "Next "
    if RS.RecordCount <> -1 then
    NextSet = (RS.RecordCount - NextRecordNumbe r) + 1
    if NextSet > RS.PageSize then
    NextSet = RS.PageSize
    end if
    NextString = NextString & NextSet & " documents"
    else
    NextString = NextString & " page of documents"
    end if
    %>
    <input type="submit" value="<%=NextS tring%>">
    </form>
    </td>
    <%SaveQuery = TRUE%>
    <%end if%>

    </TABLE>


    <!-- Display the page number -->

    Page <%=CurrentPage% ><%if RS.PageCount <> -1 then
    Response.Write " of " & RS.PageCount
    end if %><%
    ' If either of the previous or back buttons were displayed, save the query
    ' and the recordset in session variables.
    if SaveQuery then
    set Session("Query" ) = Q
    set Session("Record Set") = RS
    else
    RS.close
    Set RS = Nothing
    Set Q = Nothing
    set Session("Query" ) = Nothing
    set Session("Record Set") = Nothing
    end if
    %><% end if

    elseif not NewQuery then
    Response.Write ""
    else
    Response.Write "Please enter a word or phrase to search for."
    end if

    %>[/code]
    Last edited by jhardman; Sep 27 '07, 04:02 PM. Reason: put code in code tags. please use code tags in the future, notice the button marked --#--
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Originally posted by md9108
    I created, using some borrowed code, an asp search page for our intranet. I'm using frontpage 2003. When I publish I get that complation error on different lines at different times. They all seem to do with end if and elseif statements. The last one is from line 118. I highligted it. The code below is:
    [code=asp]...
    *********(line1 18) if RS.RecordCount <> -1 and NextPageNumber <> -1 *******then RS.AbsolutePage = NextPageNumber
    ...[/code]
    I thought when I first looked at your code that you had mis-copied this line because it should not look like this. It is possible that the code has been edited with something that put line breaks in inappropriate places, but most of the code looks well-documented and well-written. Anyway, there are a couple of different ways if statements can be written depending on programmer preference and need. It could be all onone line like this: [code=asp]IF condition THEN response[/code] or split into multiple lines like this: [code=asp]IF condition THEN
    response
    end if[/code]It appears that the "then" was put on the next line of your code here, but it should not be. It looks like your code is supposed to be this: [code=asp]if RS.RecordCount <> -1 and NextPageNumber <> -1 then
    RS.AbsolutePage = NextPageNumber
    'a couple other lines
    end if[/code]I didn't try to run and read through all of your code, so there could easily be other problems. see if you can work it out, or ask me again.

    Jared

    Comment

    • md9108
      New Member
      • Sep 2007
      • 9

      #3
      Adding the different lines actually corrected that problem. Thank you so very much. I got my search box, but received another error like the one before only different.
      The code is
      Code:
       end if ' NOT RS.EOF%>
      the error is this

      Microsoft VBScript runtime error '800a01a8'

      Object required: ''

      /search/default.asp, line 93

      I have no idea were a tic would go. Would this be a reference problem?

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        Originally posted by md9108
        Adding the different lines actually corrected that problem. Thank you so very much. I got my search box, but received another error like the one before only different.
        The code is
        Code:
         end if ' NOT RS.EOF%>
        the error is this

        Microsoft VBScript runtime error '800a01a8'

        Object required: ''

        /search/default.asp, line 93

        I have no idea were a tic would go. Would this be a reference problem?
        This probably means that there are now too many "end if"s. This would indicate that the whole script is now pretty convoluted. Try to figure out which "end if" corresponds to which "if" (nice even tabbing helps here) and you should be able to spot the problem.

        Jared

        Comment

        • md9108
          New Member
          • Sep 2007
          • 9

          #5
          You were correct again. Thank you. I had great tests, Was having an issue with the previous page coding. Now I'm getting an error on an IF for a line where there is not IF. I'm ready to give this up.

          Comment

          • jhardman
            Recognized Expert Specialist
            • Jan 2007
            • 3405

            #6
            Originally posted by md9108
            You were correct again. Thank you. I had great tests, Was having an issue with the previous page coding. Now I'm getting an error on an IF for a line where there is not IF. I'm ready to give this up.
            I know the feeling. Once I went through something very similar to this and found that I had commented out a line that had an ASP delimiter in it, and had forgotten that of course the delimiter was still being recognized even though it was in a comment. It took me forever to find the problem.

            The best advice I can give is go through the code and systematically place tab stops when you enter an if statement or a loop etc, then eventually you should see where the structure was lost.

            The other option is to start over. If you don't even know where the error is, that might be a good idea.

            Jared

            Comment

            Working...