Solved

Type mismatch on the Split function

Posted on 2002-03-19
10
682 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
[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
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

623 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