Script Error

M

Mark A. Sam

Hello,

I am getting this error from an ASP:

Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: ""]'

/asp/loadresults.asp, line 101



It looks like there is a quote or two in the data causing the problem, and I
deleted the ones that I found which didn't solve the problem. Whenever I
have had this problem and cleaned the problem character it has resolved the
issue.



Any ideas on this?

God Bless,



Mark A. Sam
 
K

Kevin Spencer

It's not possible to tell without seeing the code.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
M

Mark A. Sam

Hello Kevin,

First here is the offending line....

tlength = rs("TrailerLength")

TrailerLength is a Text field in an Access Table. I checked the data,
especially the area after the last line printed on the search results and
could find no problem.

Here is the entire Method:

<%

SortBy = Request.Form("SortBy")
SortMess = ""
If SortBy = "DateLoading" then
SortOrder = "DateLoading, OriginState, OriginCity, DestinationState,
DestinationCity "
SortMess = "Sorted by Load Date/ Origin State/ Destination State"
ElseIf SortBy = "OriginState" then
SortOrder = "OriginState, OriginCity, DestinationState, DestinationCity,
DateLoading"
SortMess = "Sorted by Origin State/ Destination State/ Load Date"
ElseIf SortBy = "DestinationState" then
SortOrder = "DestinationState, DestinationCity, OriginState, OriginCity,
DateLoading"
SortMess = "Sorted by Destination State/ Origin State/ Load Date"
End If


Set rs = Server.CreateObject("ADODB.RecordSet")
q = "SELECT LoadID, OriginCity, OriginState, DestinationCity, " &_
"DestinationState, DateLoading, TrailerLength, TrailerType, comments,
Recurring FROM Loads WHERE (Recurring = False) AND (1=1)"
dateavail = Request.Form("dateavail")
if dateavail <> "" then
if NOT IsDate(dateavail) then
Session("mess") = "The date you entered for the Date Loading is not
formatted properly. Please enter it again."
Response.Redirect "searchloads.asp"
else
q = q & " AND (DateLoading = #" & dateavail & "#)"
end if
else
q = q & " AND (DateLoading >= #" & date() & "#)"
end if
originstate = Request.Form("originstate")
if originstate <> "" then
q = q & " AND (OriginState LIKE '%" & originstate & "%')"
end if
destinationstate = Request.Form("destinationstate")
if destinationstate <> "" then
q = q & " AND (DestinationState LIKE '%" & destinationstate & "%')"
end if
trailertype = Request.Form("trailertype")

q = q & " AND (TrailerType LIKE '%" & trailertype & "%')"
q = q & " Order by " & SortOrder

rs.Open q, "DSN=TruckLoadsDev;"

%>
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<title>Search Loads - Matching Records</title>
<meta name="Microsoft Border" content="tb">
</head>

<body bgcolor="#FFFFFF" link="#000080" vlink="#800080" alink="#000080"
background="../images/trucksbg3.jpg">

<table width="800" cellpadding="2" align="LEFT" valign="TOP">
<tr>
<!-- Button Column -->
<td width="125" align="LEFT" valign="TOP"> </td>
<!-- Content column -->
<td align="LEFT" valign="TOP"><table border="0" width="100%">
<tr>
<td width="100%" align="left"><font size="4"><strong>Search Loads -
Matching Records</strong></font></td>
</tr>
</table>
<p><%if NOT rs.EOF then%><b><font size="2" color="#800000">Records
matching the parameters you specified are listed below. To see the details
or
contact the Company which owns the load, click on the Origin&nbsp; for
that load.</font></b></p>
<p><a href="../asp/searchloads.asp"><strong>Search
Again</strong></a></p>
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%"><b><% Response.Write SortMess %></b></td>
</tr>
</table>
</div>
<table border="0" width="800">
<tr>
<td width="155" valign="top" align="left"
bgcolor="#9999FF"><strong><font size="2">Origin
State,&nbsp; City</font></strong></td>
<td width="165" valign="top" align="left"
bgcolor="#9999FF"><strong><font size="2">
Destination State, City</font></strong></td>
<td width="128" valign="top" align="left"
bgcolor="#9999FF"><strong><font size="2">Trailer Type</font></strong></td>
<td width="78" valign="top" align="left"
bgcolor="#9999FF"><strong><font size="2">Date
Loading</font></strong></td>
<td width="242" valign="top" align="left"
bgcolor="#9999FF"><strong><font size="2">Comment</font></strong></td>
</tr>

<%while NOT rs.EOF
Datel = ""
Recur = ""
if rs("Recurring") = False then
DateL = rs("DateLoading")
else
Recur = "Recurring"
End If
if rs("TrailerLength") = 0 then
tLength = ""
else
tlength = rs("TrailerLength")
End If


%>
<tr>
<td width="155" valign="top" align="left" bgcolor="#FFFFFF"><a
target="_blank" href="loaddetails.asp?loadid=<%=rs("LoadID")%>"><font
size="2"><%Response.Write rs("OriginState") & ", " &
rs("OriginCity")%></font></a>
</td>
<td width="165" valign="top" align="left" bgcolor="#FFFFFF"><font
size="2"><%=rs("DestinationState") & ", " & rs("DestinationCity")%></font>
</td>
<td width="128" valign="top" align="left" bgcolor="#FFFFFF"><font
size="2"><%=tlength & " " & rs("TrailerType")%></font>
</td>
<td width="78" valign="top" align="left" bgcolor="#FFFFFF"><font
size="2"><%=DateL%></font>
</td>
<td width="242" valign="top" align="left" bgcolor="#FFFFFF"><font
size="2"><%=rs("Comments")%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;</font> </td>
</tr>
<tr>
<%
rs.MoveNext

wend%>
</tr>
</table>
<p><strong><a href="../asp/searchloads.asp">Search Again</a>
<br>
</strong></p>
<p><%else%></p>
<p><strong><font size="4"><font color="#FF0000">No Loads matched your
query.</font>&nbsp;&nbsp;
<a href="../asp/searchloads.asp">Try again</a></font></strong></p>
<p><%end if%>
<p>&nbsp;</td>
</tr>
<tr>
<td width="150" align="LEFT" valign="TOP"></td>
<td align="LEFT" valign="TOP"><b><span lang="en-us"><font face="Arial">
<font color="#FF0000">We would like you to take a survey for a new
service
to help you get more business.</font><br>
<a target="_blank"
href="http://www.Plan-It-Earth.Net/TLOSurvey/Default.htm">
Click Here</a></font></span></b></td>
</tr>
</table>

<p>&nbsp;<img
src="http://www.stattrax.com/cgi/stattrax.cgi?account=3333&amp;page=513"
width="1" height="1"> </body>
</html>
 
K

Kevin Spencer

Hi Mark,

That's odd. I would think that your error would occur when you try to
concatenate the value into a string. This could cause an error if the value
of the field was null in the database. You can't concatenate Nothing into a
string (type mismatch).

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
M

Mark A. Sam

Many of the values for trailer length are null and it hasn't been a problem
in the past that I know of, but tomorrow morning I will copy the database
down and fill the blank fields with a value of 0 and see if that fixes it.

Thank you Kevin,

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top