split function and arrays
Hi there. I'm applying this function in Access 2010 so I've added the question to the Office Development thread even though it may apply elsewhere.
I have some code.
It splits some strings and feeds the results into a database table using the split function.
When I loop through the data I re-use the same name for the array, eg. splitstring = split(mystring,",")
Should I be erasing the splitstring array after every loop iteration? or does the re-use of the same array name automatically redim the array?
Reason I ask is after I get through some 2000+ iterations the code starts slowing down and I am wondering whether it's due to incrasing memory usage (through non-erasure of arrays) or it's just the strings I'm splitting?
Hope that made sense.
Cheers
Re: split function and arrays
I don't believe you'd need to clear the array in each loop. I would think that would slow things down even more. Maybe you could post your code so we could see if there is anything else that might be the cause of the slow down?
Re: split function and arrays
while i would agree with bryce, i remember reading somewhere recently, where clearing arrays could help with some issues
anyway it is very simple to do it to test if it helps
erase splitstring
Re: split function and arrays
thanks for the answers guys.
I was debugging overnght and found that in fact i wasn't the arrays but the database insertion method I was using.
I created a recordset everytime i wanted to append to the table. Once the table got to >60000 records, the act of creating the recordset was the process that was slowing down.
I now use a db.execute query step to insert the information and whilst it is slower at first, it is consistent and access speed does not slow once you get to >60000 records so overall gains are better.
Cheers