PRB: Error: Couldn't Lock File SHARE.EXE Hasn't Been Loaded

ID: Q110732


The information in this article applies to:


SYMPTOMS

Trying to use a Microsoft Access Database that is located on a Read-Only Share or Network Drive might generate the following error:

Couldn't lock file SHARE.EXE hasn't been loaded.


CAUSE

When Visual Basic tries to connect to a Microsoft Access database, an .LDB file is created or the existing .LDB is used in the Database directory.

The .LDB file is used to assist in the management of the file locking mechanism with multiple users. This file must be in the same directory as the database and the file or directory must have Read/Write access or the above error is generated.

This happens because the Microsoft Access engine in Visual Basic cannot create or write to the necessary .LDB file.


RESOLUTION

To prevent the use or creation of the .LDB file, open the database Exclusive use and Readonly (because of the read-only attribute of the server) access. This tells the Microsoft Access Engine that the database will be opened for single user only and that the .LDB file will not be necessary.

If the multi-user access needed is read-only access, users do not have to have read/write access to the LDB file. They only need read/write access if they want to change the database. In reality, you can have each user open a read-only database for exclusive access and no error would be generated. In fact, this is what you need to do in Visual Basic for it to open an Access database by multiple users on a read-only network drive or CD-ROM drive.


STATUS

This behavior is by design.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new project in Visual Basic. Form1 is created by default.


  2. Add a Data Control to Form1, and set its Read-Only property to True.


  3. In the DatabaseName property of the Data Control, enter the name of a Microsoft Access Database that is located on a Read-Only network share.


  4. Run the application, and you will receive Error 3050: Couldn't lock file SHARE.EXE hasn't been loaded.


Additional query words: 3.00 4.00 vb4win vb416


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: June 10, 1999