Solved

File already open or not

Posted on 2003-11-04
4
286 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 50 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

737 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