473,320 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Microsoft VBScript runtime (0x800A01A8)

The ASP page has a combo box with id list, and when user click the
particular id, it will show the name in the text box. My attempt was when
the user have event on combo box, it will call JavaScript showempname(), and
it will then look up the name by executing SQL statement.

However, the following code has the following error:

Microsoft VBScript runtime (0x800A01A8)
Object required on line " sqlStmt = "select * from employee where EmployeeID
= "
<script language="JavaScript">
function showempname()
{
if (document.eventform.id.length > 1)
{
<%
Dim objRS
set objRS = Server.CreateObject("ADODB.Recordset")
sqlStmt = "select * from employee where EmployeeID = " _
& "'" & document.eventform.id.value & "'" & ";"
objRS.Open sqlStmt, strConnect
document.eventform.empname.value = objRS("FirstName")
Set objRS = Nothing
%>
}
}
</script>
</head>

<body>
<form name="eventform" action method="post">
<select name="id" onchange="showempname()">
<option value="1001">1001</option>
<option value="1002">1002</option>
<option value="1003">1003</option>
</select>

<P>Name: <input type="text" name="empname">
Any ideas?? thanks!!
Jul 19 '05 #1
3 7274

"Matt" <ma*******@hotmail.com> wrote in message
news:eF**************@TK2MSFTNGP11.phx.gbl...
<%
Dim objRS
set objRS = Server.CreateObject("ADODB.Recordset")
sqlStmt = "select * from employee where EmployeeID = " _
& "'" & document.eventform.id.value & "'" & ";"
Any ideas?? thanks!!


You're mixing client side code with server side code.

You need to use REquest.Form("ID") to read the form value when the page is
posted back to the server.

Also, I would say using the name 'ID' for your <select> is just asking for
trouble - rename it something unique that isn't a common key word.

eg 'EmpID'

Jul 19 '05 #2
Matt,
you are trying to do something really odd
You cannot mix clientside javascript and server side
code.
--
Roji. P. Thomas

--------------------------------------
"Matt" <ma*******@hotmail.com> wrote in message
news:eF**************@TK2MSFTNGP11.phx.gbl...
The ASP page has a combo box with id list, and when user click the
particular id, it will show the name in the text box. My attempt was when
the user have event on combo box, it will call JavaScript showempname(), and it will then look up the name by executing SQL statement.

However, the following code has the following error:

Microsoft VBScript runtime (0x800A01A8)
Object required on line " sqlStmt = "select * from employee where EmployeeID = "
<script language="JavaScript">
function showempname()
{
if (document.eventform.id.length > 1)
{
<%
Dim objRS
set objRS = Server.CreateObject("ADODB.Recordset")
sqlStmt = "select * from employee where EmployeeID = " _
& "'" & document.eventform.id.value & "'" & ";"
objRS.Open sqlStmt, strConnect
document.eventform.empname.value = objRS("FirstName")
Set objRS = Nothing
%>
}
}
</script>
</head>

<body>
<form name="eventform" action method="post">
<select name="id" onchange="showempname()">
<option value="1001">1001</option>
<option value="1002">1002</option>
<option value="1003">1003</option>
</select>

<P>Name: <input type="text" name="empname">
Any ideas?? thanks!!

Jul 19 '05 #3
so how can i handle this in my case?

well, if the user select the EmployeeID in combo box, and then click the
submit button, and it will look up database and show the Employee Name in
the text box, this is easy.

But my case is: when the user select the employeeid in combo box, it will
fire the onchange event, and then look up database and show the employee
name in the text box. There is no submit button.

I really have no idea how to do that.
"Roji. P. Thomas" <la********@somewhere.com> wrote in message
news:%2***************@TK2MSFTNGP10.phx.gbl...
Matt,
you are trying to do something really odd
You cannot mix clientside javascript and server side
code.
--
Roji. P. Thomas

--------------------------------------
"Matt" <ma*******@hotmail.com> wrote in message
news:eF**************@TK2MSFTNGP11.phx.gbl...
The ASP page has a combo box with id list, and when user click the
particular id, it will show the name in the text box. My attempt was when the user have event on combo box, it will call JavaScript showempname(),

and
it will then look up the name by executing SQL statement.

However, the following code has the following error:

Microsoft VBScript runtime (0x800A01A8)
Object required on line " sqlStmt = "select * from employee where

EmployeeID
= "
<script language="JavaScript">
function showempname()
{
if (document.eventform.id.length > 1)
{
<%
Dim objRS
set objRS = Server.CreateObject("ADODB.Recordset")
sqlStmt = "select * from employee where EmployeeID = " _
& "'" & document.eventform.id.value & "'" & ";"
objRS.Open sqlStmt, strConnect
document.eventform.empname.value = objRS("FirstName")
Set objRS = Nothing
%>
}
}
</script>
</head>

<body>
<form name="eventform" action method="post">
<select name="id" onchange="showempname()">
<option value="1001">1001</option>
<option value="1002">1002</option>
<option value="1003">1003</option>
</select>

<P>Name: <input type="text" name="empname">
Any ideas?? thanks!!


Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt | last post by:
<% hour = Request("controlname") %> will yield the following error: Microsoft VBScript runtime (0x800A01F5) Illegal assignment: 'hour' However, if I declare hour, then it is fine. <% Dim...
1
by: Carolyn Speakman | last post by:
Hi, I'm trying to amend an intranet .asp page but keep getting this error. The error only occurs when I pull the WHOLE intranet off the server and try to run it locally. The error isn't there...
1
by: PaulieS | last post by:
Hi all. Am migrating a customer from IIS5 on W2K server to IIS6 on W2K3. Zipped all the websites and unzipped them to the identical locations on new server. Used IISMT to migrate metabase. ...
2
by: anidmarty | last post by:
Hey I'm a Sysadmin and my users are getting this error on my production box. It works fine on the dev box. There is a script that is run that generates this error. Production is clustered...
0
by: =?Utf-8?B?TWF0dCBDYWxob29u?= | last post by:
HI there, I am getting an error on my page which calls up a web service. Microsoft VBScript runtime error '800a13ba' Unknown runtime error: 'SearchQueryXML' /SearchResults.asp, line 142
4
by: Genken | last post by:
Hi can anybody help me i get this error when running this code. Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: '' And then a line number indicating where the error is, i...
1
by: mudasserrafiq | last post by:
I am using following asp file default.asp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META content="0...
10
by: jasone | last post by:
hi everyone! any advice given will be MUCH appreciated, i have spent about 10 hours on this bit of script... a rating system. I am having realt trouble overcoming this problem at runtime ...
1
by: deepakalra | last post by:
hi, my project is about displaying map(and its info) based on query fired..the result of the query should be displayed in the form of report(collecting data from database)...the problem is when i...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.