?
Solved

ASP - Type Mismatch Error using LEFT

Posted on 2007-11-21
2
Medium Priority
?
484 Views
Last Modified: 2012-05-05
Hi

I have a form which posts a series of orderid deliminated by a comma, the following code splits the order numbers

Dim arrRegistrants
 arrRegistrants=Split(Request.Form("orderid"),",")
 
I then need to get the 1st number of the orderid.. ie. if the order number is 400001 then i need 4 if it was 600001 then I need to get 6, so I added the following

DIM refid
refid =  LEFT ((arrRegistrants) ,2)
response.write refid

but I get this error
Microsoft VBScript runtime error '800a000d'
Type mismatch

any help appreciated


0
Comment
Question by:sparky74
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Expert Comment

by:SjoerdvW
ID: 20326962
http://www.dotnet247.com/247reference/msgs/18/92373.aspx:

You are working in a Form class which has a Left property. The reason Left() returns an integer is because VB assumes you want to use the method/property that exists in the same, or closest imported, scope that you are working (hence, MyForm.Left, a property of the inherited class that you are working in, is more logical to assume than Microsoft.VisualBasic.Strings.Left()).

Try any of these:

Microsoft.VisualBasic.Strings.Left(Str, Len)
Microsoft.VisualBasic.Left(Str, Len)
Strings.Left(Str, Len)
0
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 total points
ID: 20326976
HI sparky74,

The variable 'arrRegistrants' is an array, as specified by the use of the Split function. To use the Left function on a string in that array, you need to specify the index of the item....

    DIM refid
    refid =  LEFT ((arrRegistrants(0)) ,2)
    response.write refid

Regards,

Wayne
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question