13 - Type mismatch

B

Bill

The split statement keeps bombing with a runtime
error 13 - Type mismatch.

The current value of OldName is:
01.06.08;John 17.1-3;;;.mp3

I tried dimming OldName as variant, but that didn't
have any effect.

Any ideas as to what might be the cause of the error?

Private Function FormatNewName(OldName As String) As String
Dim arrParse() As Variant
Dim arrTemp() As Variant
Dim strBK As String
Dim strBkID As Variant
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
' This function assumes that ManFix has resolved OldName to
' at lease the nominal 5 tokens:
' ID;Book and Reference;Presenter;comment;filetype
'*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
arrParse = Split(OldName, ";")

[snip]

FormatNewName = blah blah blah
End
 
B

Bill

It would appear that David Fenton is right about
Split returning a string, as I changed the dim of
arrParse to string and everything worked okay.

Up until this time, I had always dimmed arrays
of the type as string. However, Vinson suggested
that they should be dimmed as variant, so I
did..........John is seldom wrong.
Bill
 
J

John W. Vinson

It would appear that David Fenton is right about
Split returning a string, as I changed the dim of
arrParse to string and everything worked okay.

Up until this time, I had always dimmed arrays
of the type as string. However, Vinson suggested
that they should be dimmed as variant, so I
did..........John is seldom wrong.

Well, I certainly was this time... my apologies for posting without checking!!

Glad it's working for you, and thanks, David.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
B

Bill

No big deal John, I rather suspect that your
batting average is much better than mine.
Bill
 
D

Douglas J Steele

Arriving late to the discussion, but to dimension as a variant, you'd
strictly use

Dim arrParse As Variant

Once you've run

arrParse = Split(OldName, ";")

then you can treat arrParse as an array.

See: John _was_ right!

"Bill" wrote in message

It would appear that David Fenton is right about
Split returning a string, as I changed the dim of
arrParse to string and everything worked okay.

Up until this time, I had always dimmed arrays
of the type as string. However, Vinson suggested
that they should be dimmed as variant, so I
did..........John is seldom wrong.
Bill
 

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