Solved

Determining if files are open

Posted on 1998-11-19
3
127 Views
Last Modified: 2010-05-03
I have some files that are sitting on a folder on an NT Server. From my Win95/98 workstation I would like to determine if the files are currently open by another user. I would appreciate any source code or suggestions that anybody would have.
0
Comment
Question by:Sanju043097
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
vikiing earned 50 total points
ID: 1445669
Try to open the file this way:

   On error resume next
   Open "filename.ext" for input lock read write as #1
   errcode = err        'Catch possible error
   Close #1
   If errcode=70  then      '70 = Permission denied
       <file is open by another user>

It's possible the so-generated error (if the file is already open) be a different number, so first run the program without On Error and see what happens.

0
 

Author Comment

by:Sanju043097
ID: 1445670
Thanks, that worked great.
0
 
LVL 3

Expert Comment

by:vikiing
ID: 1445671
Sanju: with that piece of code, ¿is really 70 the error value you get?. I was not sure, then I suggested the most probable one.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now