Solved

Determining if files are open

Posted on 1998-11-19
3
128 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

777 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