After our VB6 program worked for many years without problem, some users have began getting intermittent file opening errors. This started three or four years ago (not sure when) only for some users.
Our development machine has never had these errors, so we cannot replicate their situation.
The program posts a batch of data from some files into another system. When the error occurs, the batch does not post, so we tell the user to try again. Sometimes they have to try many times before the run is error free.
A typical issue is error 3051 when we run OpenRecordset:
Set rs = DB.OpenRecordset(szSQL, dbOpenDynaset)
"The Microsoft Jet database engine cannot open the file 'our_file_name'. It is already opened exclusively by another user, or you need permission to view its data."
So this week we changed the error-handling in a key section of code to repeat the command after sleeping for a second.
Though this seems so far to have worked, the code is complex and difficult to maintain, with OpenRecordset in many places, so I do not want to do this everywhere. Do you have any suggestions?
I do not have access to the user's PC to check which processes might have the file open.
We are reading VFP .DBF and Access .MDB files.
PS Since my initial post, somebody suggested anti-virus software might be responsible. I am investigating this.