?
Solved

File already open or not

Posted on 2003-11-04
4
Medium Priority
?
294 Views
Last Modified: 2010-05-03
How do I determine if a file has already been opened by another user?

I have tried using GetAttr(filename)but it is not giving me the correct answer, ie 1.
0
Comment
Question by:GNCstar
[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
  • 2
4 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 9679047
You could do something like:

Open strFile For Output Lock Write As #1

And catch error 55 "File already open"
0
 

Author Comment

by:GNCstar
ID: 9679134
AzraSound,

I have tried that but the code stops with Run-time error '70': Permission denied.
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 200 total points
ID: 9679294
Yes, I think Permission Denied is actually what you get.  It should be reliable for nearly all cases, though, I think it is possible to get that error if you are trying to access a file that you do not have the rights to for writing.  In addition, it should be changed to Lock Read Write instead of just Lock Write.
0
 

Author Comment

by:GNCstar
ID: 9679633
Cheers, I can see why you are the number 1.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…
Suggested Courses

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