I have a situation where two computers (A and B) are on a LAN and access a shared folder. This is all working fine. Our Access app is interfacing with a POS system that writes a text file in a particular folder. We pick up this file and process it. 99.9% of the time this works without a problem.
Occasionally, we think we have a situation where we are trying to open the text file before it is fully closed by the POS app. Our code goes something like (pseudo code follows):
findfile = dir(full-path-name)
if findfile “” then
sleep (2000)
open text file
process text file
end if
The sleep command was put in specifically to allow sufficient time for the file to be closed by the other app before we open it. We think, however, that we need a more foolproof way of detecting of the file is fully closed (or, if as we suspect, it only has an entry in the Windows FAT).
Can anyone suggest some VBA code to detect if a text file is really closed?
Thanks.