Forums

This topic is locked

Error on search form (Help).

Posted 05 Sep 2005 12:50:57
1
has voted
05 Sep 2005 12:50:57 Malcolm X posted:
Heya all. This forum is great. I wish I knew it was here months ago.

Can anyone help with the following error?

------------------------------------------------------------
Microsoft VBScript compilation error '800a0400'
Expected statement
/html/results.asp, line 21
Option Explicit
------------------------------------------------------------

This error comes up when I click the submit button in a search page which is supposed to direct to the results page. I have also included some script below.

1 <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
2 <!--#include file="../Connections/conn.asp" -->
3 <%
4 Dim Recordset1
5 Dim Recordset1_numRows
6 Set Recordset1 = Server.CreateObject("ADODB.Recordset"
7 Recordset1.ActiveConnection = MM_connSTRING
8 Recordset1.Source = "SELECT * FROM Suppliers"
9 Recordset1.CursorType = 0
10 Recordset1.CursorLocation = 2
11 Recordset1.LockType = 1
12 Recordset1.Open()
13 Recordset1_numRows = 0
14 %>
15 <%
16 Dim Repeat1__numRows
17 Dim Repeat1__index
18 Repeat1__numRows = 3
19 Repeat1__index = 0
20 Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
21 %>
22 <% Option Explicit %>
23 <html>
24 <head>
25 <title>Search</title>
26 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
27 <script language="JavaScript" type="text/JavaScript">
28 <!--

Thanks to all.

Edited by - malhyp on 17 Apr 2006 10:10:37

Edited by - malhyp on 17 Apr 2006 10:11:17

Replies

Replied 05 Sep 2005 19:00:57
05 Sep 2005 19:00:57 Dave Thomas replied:
try it like below and add the option explicit in at the start of the script to handle the variables.
been a long time since i messed around with asp now. but from what i can remember 'option explicit' has to be placed before any var's are declared.

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
&lt;%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%&gt;
&lt;% Option Explicit %&gt;
&lt;!--#include file="../Connections/connTimberseek.asp" --&gt;
&lt;%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_connTimberseek_STRING
Recordset1.Source = "SELECT * FROM Suppliers"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%&gt;
&lt;%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 3
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%&gt;
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

also helps if you search google for stuff like this as it is very very VERY common question asked. and there are already a bucnh of answers out there, and even on here if you use the search function.

regards

Dave Thomas
<b>DMX Zone Manager</b>
Replied 06 Sep 2005 11:19:24
06 Sep 2005 11:19:24 Malcolm X replied:
Dave thanks for the reply. I gave it a go and it worked better. It actualy came up with another error, but one that I could understand. Thank you for your support.

Malcolm R.

Reply to this topic