I'm looking to optimize a split function by allowing users to enter delimiters into table, and then later on be able to split a string using the delimiters users have chosen. So intead of the delimiter being fixed, it would be flexible depending on what is chosen.
I would get an array via the following:
Do Until Split_table.EOF = True
'add splitter seperator if needed
If Len(Split_Array) > 0 Then Split_Array = Split_Array & ", "
'add splitter address
Split_Array = Split_Array & Split_table("EnterSplit").Value
Split_table.MoveNext
Loop
aSplit = Array(Split_Array)
Normally a part of the code would look like this:
Do Until rstTitles.EOF
astrKeywords = Split(rstTitles!Title, " ")
For intLoop = 0 To UBound(astrKeywords)
' Add each keyword to the temp recordset
rstWordCount.AddNew
rstWordCount!Keyword = astrKeywords(intLoop)
rstWordCount.Update
' Clean up memory
astrKeywords(intLoop) = ""
Next intLoop
rstTitles.MoveNext
Loop
In the second line, the " " would instead be an array (aSplit).
Simply putting aSplit instead of " " doesn't work (error #13 type mismatch) so there is something I'm missing or the function simply doesn't like to have to reference something outside of itself.
Any ideas or am I stretching this function too far? Thanks.
I would get an array via the following:
Do Until Split_table.EOF = True
'add splitter seperator if needed
If Len(Split_Array) > 0 Then Split_Array = Split_Array & ", "
'add splitter address
Split_Array = Split_Array & Split_table("EnterSplit").Value
Split_table.MoveNext
Loop
aSplit = Array(Split_Array)
Normally a part of the code would look like this:
Do Until rstTitles.EOF
astrKeywords = Split(rstTitles!Title, " ")
For intLoop = 0 To UBound(astrKeywords)
' Add each keyword to the temp recordset
rstWordCount.AddNew
rstWordCount!Keyword = astrKeywords(intLoop)
rstWordCount.Update
' Clean up memory
astrKeywords(intLoop) = ""
Next intLoop
rstTitles.MoveNext
Loop
In the second line, the " " would instead be an array (aSplit).
Simply putting aSplit instead of " " doesn't work (error #13 type mismatch) so there is something I'm missing or the function simply doesn't like to have to reference something outside of itself.
Any ideas or am I stretching this function too far? Thanks.