daver5481
daver5481

Reputation: 11

Access VBA Runtime Error 3052 File Sharing Lock Count Exceeded with files smaller than some that work

I am trying to import moderate sized tab delimited text files into Access using VBA. If the table doesn't already exist, the sub will create a new table using the first line of the text file to identify the fields. The sub will then open the table and read each line in from the text file, split the line based on the delimiter, and add the fields to the table, using .addnew or. edit depending on whether or not the table had to be created. The code works fine when creating a new table, and most of the time when overwriting and existing table. But for a couple of files, when overwriting an existing table, using the same data file I used to create the table, I'm getting Error 3502. Before anyone asks, yes, I've looked at many posts on this topic. They all talk about breaking up the data or editing the registry, neither of which I'm in a position to do, although I may end up having to break up the data and see what happens. I'm trying to understand what is going on.

One of the "offending" files has a record count of around 32,000 records, another around 75,000. Both have field counts of around 25. What is confusing me is that I also have files with record counts over 200,000, with similar field counts, but they work fine, both when creating a new table and when overwriting an existing table. I believe the answer to my first question, why can I create a new table but not be able to overwrite an existing table using the same data, is because when creating a new table there is nothing to lock (someone please correct me if I'm wrong), whereas the table has to be locked when editing. But why is it that I am getting this error for admittedly a lot of data, but not getting it when importing as much as 3 times as much data? I don't think I understand what is getting locked enough to be able to determine what is different within the data to cause this. Any thoughts would be appreciated.

By the way, as I mentioned, the code works, so I haven't posted it. But if anyone thinks it would help I could.

Upvotes: 0

Views: 30

Answers (0)

Related Questions