Either that, or you can define a flag that you set to True once it's been
dimensioned, and check that flag:
If booDimensioned Then
ReDim Preserve arrSplit(UBound(arrSplit) + 1)
Else
ReDim arrSplit(0)
booDimensioned = True
End If
BTW, ReDim is an "expensive" operation in terms of resource requirements.
What I typically do is increase the size by, say, 50 elements at a time, and
then do a final ReDim once I know the actual size. Yes, it means you have to
keep track of how many elements you've added, and then ReDim when you've
used up those 50 slots.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> The reason you are getting this error:
> ReDim Preserve arrSplit(UBound(arrSplit) + 1) <-- ERROR occurs
[quoted text clipped - 96 lines]
>> > > Thanks!
>> > > Jay
Klatuu - 06 Nov 2006 16:16 GMT
Adding 50 at a time is a reasonable approach. When possible, I try to
determine the number of elements needed prior to any dimensioning. Sometimes
you can't. In this situation, however, I would count the number of delimiter
characters first and that would be the number of elements needed.
> Either that, or you can define a flag that you set to True once it's been
> dimensioned, and check that flag:
[quoted text clipped - 112 lines]
> >> > > Thanks!
> >> > > Jay
Douglas J. Steele - 06 Nov 2006 16:30 GMT
An easy way to know how many of specific character exists in a string is to
use Replace to replace that character with a ZLS (zero-length string), then
determine the difference in length of the string.
Of course, the OP is using Access 97, which doesn't have the Replace
function either...

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> Adding 50 at a time is a reasonable approach. When possible, I try to
> determine the number of elements needed prior to any dimensioning.
[quoted text clipped - 130 lines]
>> >> > > Thanks!
>> >> > > Jay
Klatuu - 06 Nov 2006 16:39 GMT
For intCtr = 1 To Len(strInput)
If Mid(strInput, intCtr, Len(strDelim)) = strDelim Then
intDelimCount = intDelimCount + 1
End If
Next intCtr
> An easy way to know how many of specific character exists in a string is to
> use Replace to replace that character with a ZLS (zero-length string), then
[quoted text clipped - 137 lines]
> >> >> > > Thanks!
> >> >> > > Jay
Jay - 06 Nov 2006 17:31 GMT
Thanks to all three of you. I got more than I expected.
Hadn't realized ReDim was 'expensive'. As expected, the solutions linked to
by Brendan were more elegant then anything I came up with.
Thanks again though. Interesting stuff.
> For intCtr = 1 To Len(strInput)
> If Mid(strInput, intCtr, Len(strDelim)) = strDelim Then
[quoted text clipped - 143 lines]
> > >> >> > > Thanks!
> > >> >> > > Jay
Douglas J. Steele - 06 Nov 2006 18:17 GMT
Or
intPos = InStr(strInput, strDelim)
Do While intPos > 0
intDelimCount = intDelimCount + 1
intPos = InStr(intPos + 1, strInput, strDelim)
Loop

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> For intCtr = 1 To Len(strInput)
> If Mid(strInput, intCtr, Len(strDelim)) = strDelim Then
[quoted text clipped - 162 lines]
>> >> >> > > Thanks!
>> >> >> > > Jay