Solved

Type mismatch on the Split function

Posted on 2002-03-19
10
618 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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/…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 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

13 Experts available now in Live!

Get 1:1 Help Now