Find who locking a txt file

hgus393

Registered User.
Local time
Today, 07:33
Joined
Jan 27, 2009
Messages
83
Hi all,

I have a database which imports text files. But if someone is locking a file the code fails. Is there a way to see who is locking the file?:confused:

Cheers

Bob
 
How is the file opened? Through VBA/Access or by double clicking the file?

What kind of file is it?

Can you not trap the error if the file could not be read, use the form timer to wait for 30 seconds, try maybe 6 more times before giving up?
 
How is the file opened? Through VBA/Access or by double clicking the file?

What kind of file is it?

Can you not trap the error if the file could not be read, use the form timer to wait for 30 seconds, try maybe 6 more times before giving up?

Hi,
It is opened with VBA, it is a normal tab seperated text file. Sure I could use a timing event but that will not tell me who is locking the file and who I should send a message to, to ask them to exit from the file.

Cheers

Bob
 
Since you're using VBA to open the file then it shouldn't be difficult.

Here's what you could do:

On successful opening of the file, you set some global variables to the UserName, Path, Date & Time of the user that opened the file.

On failure, simply check against the variables for the last person that opened the file.

If you don't want to use variables, then write to a table.
 

Users who are viewing this thread

Back
Top Bottom