Solved

Type mismatch on the Split function

Posted on 2002-03-19
10
628 Views
Last Modified: 2012-08-14
I get the following error:
Microsoft VBScript runtime error '800a000d'
Type mismatch
/updateNames.asp, line 76

line 76 looks like this: lineitem = Split("1,2,3",",")
I do dim lineitem() above

any ideas why ASP doesn't like my Split() call??

thanks in advance.
0
Comment
Question by:Pecos
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 11

Expert Comment

by:thunderchicken
ID: 6880442
try

lineitem = split("1,2,3",",",-1,1)
for z = lbound(lineitem) to ubound(lineitem)
  response.write lineitem(z)
next 'z
0
 
LVL 9

Expert Comment

by:msdixon
ID: 6880553
if instr(1, lineitem, ",") > 0 then
    lineitem = Split("1,2,3",",")
else
    ' you'll probably have to redim here, but this will give you a place to start
    lineitem = array(lineitem)
end if
0
 
LVL 6

Expert Comment

by:ebosscher
ID: 6880672
try dimming the lineitem without the dynamic array qualifier.

i.e.  you currently do it like this:

dim lineitem()

try this:

dim lineitem

the split function is looking for a variant, not an array of variants
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 9

Expert Comment

by:msdixon
ID: 6880678
true, but if there isn't a coma in the string, it won't get split into an array.
0
 

Author Comment

by:Pecos
ID: 6880684
Ok, thanks anyway, but it worked when I did this:

public lineitem
lineitem = Split("1,2,3",",")
0
 
LVL 6

Expert Comment

by:ebosscher
ID: 6880687
then it should return a zero based array.
0
 
LVL 6

Accepted Solution

by:
ebosscher earned 100 total points
ID: 6880689
see..
removed the array definition..

went from dim lineitem()
to dim lineitem    (effectively)

i was right
0
 

Author Comment

by:Pecos
ID: 6880699
nope, when I tried just 'dim lineitem' it didn't work either.
0
 

Author Comment

by:Pecos
ID: 6880703
but i'll give it to you anywayz
0
 
LVL 6

Expert Comment

by:ebosscher
ID: 6880710
where did you declare the lineitem variable?
did it move out of scope in your function?

if so the public would have changed things.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now