Runtime error '3050': Could not lock file. 
Author Message
 Runtime error '3050': Could not lock file.

I am using windows NT4 terminals. I have written a program in Visual Basic 5
that accesses an .mdb database in a folder I have read/write access to, but
that the students only have read access to.

I open the database and the table in the program like this:

Public mydb As Database
Public myws As Workspace
Public myrs As Recordset
Public Const spath = "\\svrjg01\data\newmediaview\newmediaview.mdb"

Set myws = DBEngine.Workspaces(0)
Set mydb = myws.OpenDatabase(spath, False, True) ' False shares, True gives
read only access
Set myrs = mydb.OpenRecordset("select * from test", dbOpenDynaset,
dbReadOnly)

At the same time I can open many instances of the program from one or
different machines logging on as myself. But if a student runs the program,
even if noone else has the program open at that time, the error 3050 sets
in.

How should I fix this? Should the program be changed, or can't the .mdb sit
in the folder where it is now?

Grateful for any help!

Sincerely,

Jan Nordgreen



Sun, 03 Aug 2003 11:57:40 GMT  
 Runtime error '3050': Could not lock file.
When you open an .mdb file, locking information is written to the .ldb file
by the same name in the same directory.  So the short answer is - no, you
can't put the .mdb file in a directory that is write protected.  Instead of
using directory access control, implement user security for your database.

A recommended approach to creating a multiuser Access/Jet database (.mdb),
includes splitting the database in two parts, a "private" database of which
each user has a (local) copy, and a "shared" database.  In this approach,
any predefined queries, temporary tables, etc. are defined in the "private"
database.  All the tables with the shared data reside in the "shared"
database, and the private databases include links to the shared tables.  I
suspect that even in this approach, an .ldb file in the directory with the
shared database file will be updated using the user privilege of the
individual client, but it may be worth a try, since you *should* do this
anyway.

HTH,
Tore.


Quote:
> I am using windows NT4 terminals. I have written a program in Visual Basic
5
> that accesses an .mdb database in a folder I have read/write access to,
but
> that the students only have read access to.

> I open the database and the table in the program like this:

> Public mydb As Database
> Public myws As Workspace
> Public myrs As Recordset
> Public Const spath = "\\svrjg01\data\newmediaview\newmediaview.mdb"

> Set myws = DBEngine.Workspaces(0)
> Set mydb = myws.OpenDatabase(spath, False, True) ' False shares, True
gives
> read only access
> Set myrs = mydb.OpenRecordset("select * from test", dbOpenDynaset,
> dbReadOnly)

> At the same time I can open many instances of the program from one or
> different machines logging on as myself. But if a student runs the
program,
> even if noone else has the program open at that time, the error 3050 sets
> in.

> How should I fix this? Should the program be changed, or can't the .mdb
sit
> in the folder where it is now?

> Grateful for any help!

> Sincerely,

> Jan Nordgreen



Mon, 04 Aug 2003 01:52:21 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Run-time error '3050': Could not lock file

2. 3050 error - Couldn't Lock File

3. Error 3050 - Couldn't Lock File

4. HELP: Error 3050 Couldn't lock file

5. Error 3050 , couldn't lock file

6. Error 3050 , couldn't lock file

7. Error 3050 - Couldn't Lock File

8. Error 3050 , couldn't lock file

9. VB6 Error 3050 Could not Lock File

10. Error 3050 'Can't Lock File' (undocumented)

11. Run-Time error '3050' Can't lock file

12. ERROR - 3050 couldn′t lock file

 

 
Powered by phpBB® Forum Software