Split function

J

John

Hi

Could someone please post a split function to split a string into an array
based on a separator such as comma?

Thanks

Regards
 
A

Andi Mayer

Hi

Could someone please post a split function to split a string into an array
based on a separator such as comma?

Thanks

ary=split(theString,",")

or type split into Help
or write split --- highlight it ----- press F1

If you expect an answer to a personal mail, add the word "manfred" to the first 10 lines in the message
MW
 
K

Ken Snell [MVP]

There is a Split function in ACCESS 2000 and higher version.

MyArray = Split(MyString, ",")

If you're using ACCESS 97, you can do a Google search on the newsgroups for
many posted functions that will do this for you.
 
D

Douglas J. Steele

If you're using Access 97 (or older), so that you don't have the built-in
Split function mentioned in the other posts, take a look at
http://support.microsoft.com/?id=188007

It's not the most efficient code, but it does work. Note, though, that you
need to change the declaration from

Public Function Split(ByVal sIn As String, Optional sDelim As _
String, Optional nLimit As Long = -1, Optional bCompare As _
VbCompareMethod = vbBinaryCompare) As Variant

to

Public Function Split(ByVal sIn As String, Optional sDelim As _
String, Optional nLimit As Long = -1, Optional bCompare As _
Long = vbBinaryCompare) As Variant
 
Top