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

Last reviewed: October 29, 1995
Article ID: Q110732
The information in this article applies to:
  • Professional and Enterprise Editions of Microsoft Visual Basic, 16-bit only, for Windows, version 4.0
  • Standard and Professional Editions of Microsoft Visual Basic for Windows, versions 3.0

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 reference words: 3.00 4.00 vb4win vb416
KBCategory: kbprg kbprb
KBSubCategory: APrgDataOther



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 29, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.