Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP Compilation error '800a0401' 1

Status
Not open for further replies.

larryman

Programmer
Jun 16, 2000
63
US
Hi all,
I keep getting this error

"Microsoft VBScript compilation error '800a0401'

Expected end of statement

/webapps/minor/newserviceorderhtml.asp, line 43

Msg = Msg & &quot;<a href= Approve </a>&quot;
----------------------------------------------------------------------------------------^&quot;
whenever i try to run the lines of code below from another page



<% @Language=&quot;VBScript&quot;%>
</head>
<%
'declare all local variables
dim conn 'As ADO.Connection
dim rs 'As recordset
Dim myMail

'Create the Connection Object
Set dcnDB = Server.CreateObject(&quot;ADODB.Connection&quot;)
dcnDB.ConnectionString = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot;_
& &quot;Data Source=f:\Aspdatabase\Database\userrequisition.mdb&quot;
dcnDB.Open

'Create the recordset object
set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rs.Open &quot;SELECT * FROM Requisition&quot;, _
dcnDB, 2,2

rs.addnew

rs(&quot;To&quot;) = request(&quot;txtTo&quot;)
rs(&quot;From&quot;) = request(&quot;txtFrom&quot;)
rs(&quot;Centre_Code_No&quot;) = request(&quot;txtCodeNo&quot;)
rs(&quot;Date&quot;) = request(&quot;txtDate&quot;)
rs(&quot;Time&quot;) = request(&quot;txtTime&quot;)
rs(&quot;Ref&quot;) = request(&quot;txtref&quot;)
rs(&quot;Requisition_For&quot;) = request(&quot;requestfor&quot;)
rs(&quot;Service_Desc&quot;) = request(&quot;description&quot;)
rs(&quot;Email&quot;) = request(&quot;HeadEmail&quot;)
rs.update
rs.MoveLast
link = rs(&quot;Requisition_id&quot;)
%>


<SCRIPT Language=&quot;VBScript&quot; Runat=&quot;Server&quot;>
Msg = &quot;Please Click here to approve this form&quot;
Msg = Msg & &quot;<a href= Approve </a>&quot;

Set myMail = CreateObject(&quot;CDONTS.NewMail&quot;)

myMail.From = &quot;Olanrewaju.Ogunkunle@mydomain.com&quot;
myMail.To = &quot;Olanrewaju.Ogunkunle@mydomain.com&quot;
myMail.Subject = &quot;Testing&quot;
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = Msg
myMail.Send
</SCRIPT>


<body>

<h3> Your Form has been sent to your Manager For Processing</h3>
<h3> Your Order Id is <% =rs(&quot;Requisition_id&quot;) %> <h3>
</body>

<%
rs.close
dcnDB.Close
%>

The problem is dynamically passing rs(&quot;requisition_id&quot;) to the href link to be sent by mail through CDONTS. If i put a value in place of rs(&quot;requisition_id&quot;), it works fine.

Thanks
Oysterbar ride to success. Keep Riding
 
Thanks JuanitaC,
I have made the modification like you suggested but i got a new error on the page. The error is:

ADODB.Recordset error '800a0cc1'

Item cannot be found in the collection corresponding to the requested name or ordinal.

/webapps/minor/newserviceorderhtml.asp, line 43

I tried to check rs(&quot;requisition_id&quot;) and it worked fine from the number generated above giving the presently value after update.

Oysterbar ride to success. Keep Riding
 
Why do you switch from
<%
...
%>
to
<SCRIPT Language=&quot;VBScript&quot; Runat=&quot;Server&quot;>
...
</script>
?

I always thought they were equivalent. Does it not work if all the code is within the <% %> delimiters?
 
You should not need to move last after you do your update. I ran into a similar error at one point because it wasn't updating the records in the db before I requested the id ( I am assuming your working off an autonumber or seeded key).
i can't remember exactly what I did to solve the problem, it was serveral months and many projects ago, but here are the flags I am using in my open stmt:

rs.Open &quot;Question_Set&quot;, strConnect, adOpenKeySet,adLockOptimistic, adCmdTable

strConnect is my connection string, the three keys after it are defined in a standard include file (adovbs.inc) so I couldn't tell you the numbers of the top of my head.
 
Juanitac,

changed cos i couldn't compile the script going to the body of the CDONTS. I couldn't embed <%%> in another<%%> and with <script language=&quot;vbscript&quot; runat=&quot;server&quot;>
</script>, I could easily put them together and it improves my performance instead of many <%%>. I don't think it's the problem. if you feel i could change it back

Tarwn,
It's perfectly updating the database, when it tried writing this to html page it worked fine but it's sending down to the body of the e-mail message that's the problem. if i put a value in it it also worked fine.

Thanks
larryman Oysterbar ride to success. Keep Riding
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top