add loop to skip misisng indexes

dubmunkey

Registered User.
Local time
Today, 23:13
Joined
Jan 6, 2006
Messages
62
hi

im using this vb code:

Function MySplit(myfield,separator as string,index as long)

if not isnull(myfield) then
mysplit = split(myfield,separator)(index)
else
' what value?
'mysplit = "XXX"
end if

End function

to break up an address field which is separated by chr(13) & chr(10) - works fine until i get to an index that doesn't exist...

basically most have four lines but some have three menaing the index (4) can't be found- i know there is a way round this using loop and ubound but can't get my head round the instructiosn ive found as they pertain to soemthing slightly different and every combination i try gives me errors

can anyone help?

cheers dubs
 

Users who are viewing this thread

Back
Top Bottom