View Full Version : add loop to skip misisng indexes


dubmunkey
03-12-2007, 03:40 AM
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

dubmunkey
03-12-2007, 03:41 AM
forgot to subscribe to thread