Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: Access Modules (VBA Coding) FAQ


How do I simulate the VB Split function in VBA? by bustell
Posted: 22 Apr 02 (Edited 22 Apr 02)

I have on numerous occasions wondered why the VB Split function was not include in VBA.  Here is a function that works with Access to simulate the built in VB Split function:

Public Function Split(ByVal sString As String _
                    , sDelimiter As String _
                    , Optional iCompare As Long
                            = vbBinaryCompare) As Variant
    Dim sArray() As String, iArrayUpper As Integer _
        , iPosition As Integer
    iArrayUpper = 0
    iPosition = InStr(1, sString, sDelimiter, iCompare)
    Do While iPosition > 0
        ReDim Preserve sArray(iArrayUpper)
        sArray(iArrayUpper) = Left$(sString, iPosition - 1)
        sString = Right$(sString, Len(sString) - iPosition)
        iPosition = InStr(1, sString, sDelimiter, iCompare)
        iArrayUpper = iArrayUpper + 1
    ReDim Preserve sArray(iArrayUpper)
    sArray(iArrayUpper) = sString
    Split = sArray
End Function

Back to Microsoft: Access Modules (VBA Coding) FAQ Index
Back to Microsoft: Access Modules (VBA Coding) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close