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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft VBScript runtime error '800a000d'

Status
Not open for further replies.

rjn2001

Programmer
Dec 29, 2004
172
GB
Good Afternoon,
I am trying to write change some code, that i was given on this forum, to display all the records in a table corresponding to a particular user, to add formatting, and display the results in table, with the results in a text area, to allow the user then to update their entries.
I am getting the following error msg:

Code:
Microsoft VBScript runtime error '800a000d' 

Type mismatch 

/JobProfile.asp, line 99

Line 99 is highlighted with ***********

This is the code I am having the problems with.


Code:
<%@ LANGUAGE="VBSCRIPT" %>
<!--#include file="common.asp" -->
<% 

'File: profile.asp
'Description: Profile Page

Dim strSQL 		'Database query sring
Dim strUserName 'Holds the user name
Dim strFirst_Name 'Holds the user First Name
Dim User2		' Who Sees the Profile
Dim Rand 		' Random Key
Dim JobStart	'Job Start Date
Dim JobFinsih 	'Job Finish Date
Dim EmployerName	'Employer name

strUserName = Request.QueryString("UserID")
strFirst_Name = Request.Form("First_Name")
User = Request.QueryString("User2")
rand = Request.Cookies("Zone")("Key")
JobStart = Request.Form("JobStart")



if strUserName = "" then
strUserName = Request.Cookies("Zone")("UserID")
if NOT rand = Request.Cookies("Zone")("Key") OR strUserName= "" then
response.redirect("cookie.asp?rm=expire&.rand=" & rand & "") 
End if
End If


set conn = Server.CreateObject("ADODB.Connection")
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open "D:/Websites/richard/admin/db/users.mdb"

strSQL = "Select * From tblJob WHERE UserID ='" & strUsername & "'"
Set rsCheckUser = conn.Execute(strSQL)





%>
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="[URL unfurl="true"]http://www.w3.org/TR/REC-html40">[/URL]
</style>
<link rel="stylesheet" type="text/css" href="css.css">


<xml><o:shapedefaults v:ext="edit" spidmax="1027"/>
</xml>
<body>

    <p align="center">

  

<h1>
<img height="110" src="images/BARLogo.gif" width="125" border="0">BAR - Job 
Profile</h1>
      <h2><%= strFirst_Name %>(Logged in as <%= strUsername %>)</h2>
      <table cols="2" width="500" cellspacing="0" cellpadding="0" border="0">
<tr>
  <td width="250"></td>
  <td width="250"></td>
</tr>
<%
If NOT rsCheckUser.EOF Then
  While NOT rsCheckUser.EOF
    strUserName = rsCheckUser("UserID")    

    If strUserName <> strOldUserName Then
      Response.Write "<tr><td colspan='2'><h2>" & strUserName & "</h2></td></tr>" & vbcrlf
    End If

    Response.Write "<td><p>" & rsCheckUser("JobStart") & "</p></td><td><p>" & rsCheckUser("JobFinish") & "</p></td><td><p>" & rsCheckUser("EmployerName") & "</p></td><td><p>" & rsCheckUser("JobRole") & "</p></td><td><p>" & rsCheckUser("JobDetail") & "</p></td></tr>"

    strOldUserName = strUserName
    rsCheckUser.MoveNext
  Wend
Else
  Response.Write "<tr><td colspan='2'><p>No records found</p></td></tr>" & vbcrlf
End If

Set rsCheckUser = Nothing

conn.Close
Set conn = Nothing
%>
</table>
<table height="44" width="100%" align="left" id="table1">
	<tr>
		<td align="right" width="50%" height="40">
<table BORDER=1 height="44" width="994" id="table2">
<form name="test" method="post" action="privatepageJob.asp?.rand=<%= Md5Hash %>">
    <tr id=baseRow>
        <td height="38">Start Date
          <p>
		******	<input name="JobStart" size="8" value="<%= rsCheckUser("JobStart") %>"></p> ***********
        </td>
        <td height="38">End Date
          <p><input name="JobFinish" size="8"></p>
        </td>
        <td height="38">Organisation Name
          <p><input name="EmployerName" size="25"></p>
        </td>
        <td height="38">Your Role
          <p><textarea rows="3" name="JobRole" cols="23"></textarea></p>
        </td>
        <td height="38">More Detail
          <p><textarea rows="3" name="JobDetail" cols="22"></textarea></p>
        </td>
        <td height="38">
          <p align="center">Not Deletable</p>
        </td>
    </tr>
</table>

Any help would be great!

Cheers

Richard Noon
 
you are getting the error because you are trying to read values from the recordset but you have closed the recordset eariler in the page.

Tony
_______________________________________________________________
 
Your problem is that you are trying to access a value from your recordset when you have actually closed the recordset a few lines above that. You will need to either close the recordset and connection after this point or you will need to establish a variable that you can use after the recordset is closed. Here is the relevant code:
Code:
[COLOR=red]Set rsCheckUser = Nothing

conn.Close
Set conn = Nothing[/color] [COLOR=green]'You cannot close this and still expect to use the rsCheckUser value below.[/color]
%>
</table>
<table height="44" width="100%" align="left" id="table1">
    <tr>
        <td align="right" width="50%" height="40">
<table BORDER=1 height="44" width="994" id="table2">
<form name="test" method="post" action="privatepageJob.asp?.rand=<%= Md5Hash %>">
    <tr id=baseRow>
        <td height="38">Start Date
          <p>
        ******    <input name="JobStart" size="8" [COLOR=red]value="<%= rsCheckUser("JobStart") %>"[/color]></p> ***********

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
The new art of simul-posting... :)

------------------------------------------------------------------------------------------------------------------------
If you don't have a sense of humor, you probably don't have any sense at all.
- Anonymous
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top