473,809 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft VBScript compilation error '800a0400'

9 New Member
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:
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
  2. <HTML>
  3. <HEAD>
  4.  
  5.     <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
  6.     <!--
  7.         option explicit
  8.       -->
  9.     </SCRIPT>
  10.  
  11.     <TITLE>Index Server Search Form</TITLE>
  12.  
  13.     <META NAME="DESCRIPTION" CONTENT="Sample ASP query form for 
  14.                 Microsoft Index Server">
  15.     <META NAME="KEYWORDS"    CONTENT="query, content, hit, asp">
  16.     <META NAME="MS.LOCALE"   CONTENT="EN-US">
  17.     <META HTTP-EQUIV="Content-Type" CONTENT="text/html; 
  18.                 charset=Windows-1252">
  19. <%
  20.     NewQuery = FALSE
  21.     UseSavedQuery = FALSE
  22.     QueryForm = Request.ServerVariables( "PATH_INFO" )
  23.     SearchString = ""
  24.     if Request.ServerVariables("REQUEST_METHOD") = "POST" then
  25.         SearchString = Request.Form("SearchString")
  26.         pg = Request.Form("pg")
  27.  
  28.         if pg <> "" then
  29.            NextPageNumber = pg
  30.            NewQuery = FALSE
  31.            UseSavedQuery = TRUE
  32.         else
  33.             NewQuery = SearchString <> ""
  34.         end if
  35.      end if
  36.  
  37.  %>
  38. </HEAD>
  39.     <meta name="Microsoft Border" content="t">
  40. <TABLE>
  41.     <TR>
  42.         <TD><H1>LFG Search Form</H1></TD>
  43.     </TR>
  44. </TABLE>
  45.  
  46. <HR WIDTH=75% ALIGN=center SIZE=3>
  47. <p>
  48.  
  49. <TABLE>
  50.   <TR>
  51.     <TD ALIGN=LEFT>Enter your query below:</TD>
  52.   </TR>
  53.   <TR>
  54.     <TD>
  55.       <FORM ACTION="<%= QueryForm%>" METHOD=POST>
  56.  
  57.         <TABLE>
  58.           <TR>
  59.             <TD><INPUT TYPE="TEXT" NAME="SearchString" SIZE="60"
  60.                          MAXLENGTH="100" VALUE="<%=SearchString%>"></TD>
  61.             <TD><INPUT TYPE="SUBMIT" NAME="Action" VALUE="New Query"></TD>
  62.           </TR>
  63.         </TABLE>
  64.  
  65.       </FORM>
  66.     </TD>
  67.   </TR>
  68. </TABLE>
  69. <BR>
  70.  
  71. <%
  72.  
  73. if SearchString <> "" then
  74.   if NewQuery then
  75.     set Session("Query") = nothing
  76.     set Session("Recordset") = nothing
  77.     NextRecordNumber = 1
  78.  
  79.     set Q = Server.CreateObject("ixsso.Query")
  80.     set util = Server.CreateObject("ixsso.util")
  81.     Q.Query = SearchString
  82.     Q.SortBy = "rank[d]"
  83.     Q.Columns = "DocTitle, vpath, path, filename, size, write, characterization"
  84.     util.AddScopeToQuery Q, ""
  85.  
  86.     set RS = Q.CreateRecordSet("nonsequential")
  87.  
  88.     RS.PageSize = 10
  89.     ActiveQuery = TRUE
  90.  
  91.   elseif UseSavedQuery then
  92.     if IsObject( Session("Query") ) And IsObject( Session("RecordSet") ) then
  93.       set Q = Session("Query")
  94.       set RS = Session("RecordSet")
  95.  *********(line118) if RS.RecordCount <> -1 and NextPageNumber <> -1 *******then        RS.AbsolutePage = NextPageNumber
  96.         NextRecordNumber = RS.AbsolutePosition
  97.       end if
  98.  
  99.       ActiveQuery = TRUE
  100.     else
  101.       Response.Write "ERROR - No saved query"
  102.     end if
  103.   end if
  104. %>
  105. <p>
  106. <HR width="80%" ALIGN=center SIZE=3>
  107. <p>
  108.  
  109. <%
  110.      LastRecordOnPage = NextRecordNumber + RS.PageSize - 1
  111.      CurrentPage = RS.AbsolutePage
  112.      if RS.RecordCount <> -1 AND RS.RecordCount < LastRecordOnPage then
  113.          LastRecordOnPage = RS.RecordCount
  114.      end if
  115.  
  116.      Response.Write "Documents " & NextRecordNumber & " to " & LastRecordOnPage
  117.      if RS.RecordCount <> -1 then
  118.          Response.Write " of " & RS.RecordCount
  119.      end if
  120.      Response.Write " matching the query " & chr(34) & "<I>"
  121.      Response.Write SearchString & "</I>" & chr(34) & ".<P>"
  122.  %>
  123. <dl>
  124.  
  125. <!-- BEGIN first row of query results table -->
  126. <% Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage %>
  127.  
  128. <%
  129.     ' This is the detail portion for Title, Abstract, URL, Size, and
  130.     ' Modification Date.
  131.  
  132.     ' If there is a title, display it, otherwise display the virtual path.
  133. %>
  134.     <p>
  135.     <dt><%= NextRecordNumber%>.
  136.         <%if VarType(RS("DocTitle")) = 1 or RS("DocTitle") = "" then%>
  137.             <b><a href="<%=RS("vpath")%>"><%= Server.HTMLEncode( RS("filename") )%></a></b>
  138.         <%else%>
  139.             <b><a href="<%=RS("vpath")%>"><%= Server.HTMLEncode(RS("DocTitle"))%></a></b>
  140.         <%end if%>
  141.     <dd>
  142.         <%if VarType(RS("characterization")) = 8 and RS("characterization") <> "" then%>
  143.             <b><i>Abstract:  </I></b><%= Server.HTMLEncode(RS("characterization"))%>
  144.             <br>
  145.         <%end if%>
  146.         <cite>
  147.             <a href="http://lf04/">http://LF04</a>
  148.             <font size=-1> - <%if RS("size") = "" then%>(size and time unknown)<%else%>size <%=RS("size")%> bytes - <%=RS("write")%> GMT<%end if%></font>
  149.         </cite>
  150.  
  151. <%
  152.           RS.MoveNext
  153.           NextRecordNumber = NextRecordNumber+1
  154.       Loop
  155. %>
  156.  
  157. </dl>
  158. <P><BR>
  159.  
  160. <%
  161.   else   ' NOT RS.EOF
  162.       if NextRecordNumber = 1 then
  163.           Response.Write "No documents matched the query<P>"
  164.       else
  165.           Response.Write "No more documents in the query<P>"
  166.       end if
  167.  
  168.   end if ' NOT RS.EOF
  169.  %>
  170.  
  171. <!-- If the index is out of date, display the fact -->
  172.  
  173. <%if Q.OutOfDate then%>
  174.     <P>
  175.     <I><B>The index is out of date.</B></I><BR>
  176. <%end if%>
  177.  
  178. <!--
  179.     If the query was not executed because it needed to enumerate to
  180.     resolve the query instead of using the index, but AllowEnumeration
  181.     was FALSE, let the user know
  182. -->
  183.  
  184. <%if Q.QueryIncomplete then%>
  185.     <P>
  186.     <I><B>The query is too expensive to complete.</B></I><BR>
  187. <%end if%>
  188.  
  189. <!--
  190.     If the query took too long to execute (for example, if too much work
  191.     was required to resolve the query), let the user know
  192. -->
  193.  
  194. <%if Q.QueryTimedOut then%>
  195.     <P>
  196.     <I><B>The query took too long to complete.</B></I><BR>
  197. <%end if%>
  198. <TABLE>
  199.  
  200. <!--
  201.     This is the "previous" button.
  202.     This retrieves the previous page of documents for the query.
  203. -->
  204.  
  205. <%SaveQuery = FALSE%>
  206. <%if CurrentPage > 1 and RS.RecordCount <> -1 then%> 
  207. <td align=left>
  208.         <form action="<%= QueryForm%><INPUT TYPE="HIDDEN" NAME="SearchString" VALUE="<%=SearchString%>"><INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage-1%>" ><input type="submit" value="Previous <%=RS.PageSize%> documents">
  209.         </form>
  210.     </td>
  211.     <%SaveQuery = TRUE%>
  212. <%end if%>
  213.  
  214. <!--
  215.     This is the "next" button.
  216.     This button retrieves the next page of documents for the query.
  217.     If the RS.RecordCount is available, the number of
  218.     documents on the next page will be displayed.
  219. -->
  220.  
  221. <%if Not RS.EOF then%>
  222.     <td align=right>
  223.         <form action="<%= QueryForm%>" method="POST">
  224.             <INPUT TYPE="HIDDEN" NAME="SearchString" VALUE="<%=SearchString%>">
  225.             <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage+1%>" >
  226.  
  227.             <% NextString = "Next "
  228.                if RS.RecordCount <> -1 then
  229.                    NextSet = (RS.RecordCount - NextRecordNumber) + 1
  230.                    if NextSet > RS.PageSize then
  231.                        NextSet = RS.PageSize
  232.                    end if
  233.                    NextString = NextString & NextSet & " documents"
  234.                else
  235.                    NextString = NextString & " page of documents"
  236.                end if
  237.              %>
  238.             <input type="submit" value="<%=NextString%>">
  239.         </form>
  240.     </td>
  241.     <%SaveQuery = TRUE%>
  242. <%end if%>
  243.  
  244. </TABLE>
  245.  
  246.  
  247. <!-- Display the page number -->
  248.  
  249. Page <%=CurrentPage%><%if RS.PageCount <> -1 then
  250.      Response.Write " of " & RS.PageCount
  251.   end if %><%
  252.     ' If either of the previous or back buttons were displayed, save the query
  253.     ' and the recordset in session variables.
  254.     if SaveQuery then
  255.         set Session("Query") = Q
  256.         set Session("RecordSet") = RS
  257.     else
  258.         RS.close
  259.         Set RS = Nothing
  260.         Set Q = Nothing
  261.         set Session("Query") = Nothing
  262.         set Session("RecordSet") = Nothing
  263.     end if
  264.  %><% end if 
  265.  
  266. elseif not NewQuery then
  267.     Response.Write ""
  268. else
  269.     Response.Write "Please enter a word or phrase to search for."
  270. end if
  271.  
  272. %>
Sep 25 '07 #1
5 2482
jhardman
3,406 Recognized Expert Specialist
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:
Expand|Select|Wrap|Line Numbers
  1. ...
  2.  *********(line118) if RS.RecordCount <> -1 and NextPageNumber <> -1 *******then        RS.AbsolutePage = NextPageNumber
  3. ...
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:
Expand|Select|Wrap|Line Numbers
  1. IF condition THEN response
or split into multiple lines like this:
Expand|Select|Wrap|Line Numbers
  1. IF condition THEN
  2.    response
  3. end if
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:
Expand|Select|Wrap|Line Numbers
  1. if RS.RecordCount <> -1 and NextPageNumber <> -1 then
  2.         RS.AbsolutePage = NextPageNumber
  3.         'a couple other lines
  4. end if
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
Sep 27 '07 #2
md9108
9 New Member
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
Expand|Select|Wrap|Line Numbers
  1.  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?
Sep 27 '07 #3
jhardman
3,406 Recognized Expert Specialist
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
Expand|Select|Wrap|Line Numbers
  1.  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
Sep 27 '07 #4
md9108
9 New Member
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.
Sep 27 '07 #5
jhardman
3,406 Recognized Expert Specialist
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
Sep 28 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
8154
by: Matthew Louden | last post by:
I have no idea what's wrong with the following ASP statement: Response.Write "<select name=\"id\">" MS VBScript Compilation error 800a0401 expected end of statement However, if I do the following, it will be fine: <select name="id">
3
17128
by: Matt | last post by:
When the ASP statement end with a _ character, then the next line cannot have comment ' character. Is that correct? Since I encountered the following error: Microsoft VBScript compilation (0x800A0400) Expected statement sqlStmt = "insert into TimeSlot (WeekDay, BeginTime, EndTime) VALUES (" _ ' & 2 & "," _ & beginhour & "," _
3
4674
by: Adam Short | last post by:
Can anyone help? I have all of a sudden started to receive this error on my site! I have no idea what script it is executing, why it is now failing, what is going on?? All I have been able to find out is that Microsoft has had the same problem on their site!
6
3808
by: Adam Short | last post by:
Can anyone help? I have all of a sudden started to receive this error on my site! I have no idea what script it is executing, why it is now failing, what is going on?? All I have been able to find out is that Microsoft has had the same problem on their site!
1
7541
by: aklsdjfh | last post by:
I'm no expert in asp and vbscript but not a total beginner. I've got some VBScript in an asp page which is generating a forumla for use in Lotus Notes replication. The line that it is objecting to is <% if user2 <> "" then response.write("| @IsMember(&quot;" & LCase(user2) & "&quot;;@LowerCase(@Name(;AssignedTo)))") end if %> i.e. if the string user2 is "Mike" I expect the HTML to be |...
2
5250
by: sonasiva | last post by:
{asp code} Error Type: Microsoft VBScript compilation (0x800A03EE) Expected ')' /web/company_ind.asp, line 35, column 37 Response.Write(objrs("investor_name")""<a href=""investor_ind.asp?investor_name="&objrs("investor_name")&""">"</a>"
11
18669
by: remya1000 | last post by:
While running the program, i'm getting this error Microsoft VBScript compilation error '800a0401' Expected end of statement /admin/currentmonth.asp, line 26 strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted, InvoiceDetail.Quantity, InvoiceDetail.Description, InvoiceDetail.ExtendedPrice, InvoiceInfo.GST, InvoiceInfo.PST, InvoiceInfo.Total FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN...
5
2851
by: char | last post by:
I can't figure out why I am getting error: Microsoft VBScript compilation '800a0400' SET MyRecordSet = SERVER.CREATEOBJECT("ADODB.RECORDSET") MySQL = "SELECT * FROM ShipSummary (NOLOCK) where ShipDate = DateDiff(d, 0, GetDate()+1)" MyRecordSet.OPEN MySQL, XXXXXX if not MyRecordSet.eof then MyArray = MyRecordSet.GETROWS() MyRecordSet.CLOSE FOR MyCursor = LBOUND(MyArray,2) TO UBOUND(MyArray,2)
3
6249
by: Indy | last post by:
Hi, I am new to VB and have some previous programming experiences. Curently working as an IT support person and trying to write a VB 6 script to access apos database and get one of the table's field value. I think this is not that hard for a experience VB programmer, but I am kind a stuggling. Can any one have a similler code for this task? When I am compling my code I am getting an error in the first line.
2
5004
by: kevinr | last post by:
Hi, I am brand new to VB, and I am trying to deploy Office 2007 on my network here at work. We used part of this script to do another deployment, and I have taken pieces and tried to edit for this deployment. I know I am probably way off the mark, but I would appreciate any help. This is the initial error I receive when running the script. C:\bkuptestpc\kr_migrate.vbs(276, 1) Microsoft VBScript compilation error: Expected 'End' Exit code: 1 ,...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7662
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.