Solved

Determining if files are open

Posted on 1998-11-19
3
130 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 Compile Compatibility Issue 4 131
Error when passing an argument to a vb6 that contains  '/' 7 49
VB6 ListBox Question 4 63
which modules are active in VB6 project? 6 57
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

752 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