Solved

File already open or not

Posted on 2003-11-04
4
283 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
  • 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 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…

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