[Webinar] Streamline your web hosting managementRegister Today


Another Run-Time error '3051' with Access and VB6

Posted on 1999-11-01
Medium Priority
Last Modified: 2013-12-25
I have seen similar questions posed here before, but the solutions presented have not solved my particular problem.  I have a VB6 application connecting to a password protected Access 97 database, using DAO and Jet.  On a machine where Access is installed there does not seem to be a problem, but on a machine without Access I get the:

Run-time error '3051'
The Microsoft Jet dataase engine cannot open the file.... It is already opened exclusively by another user, or you need permission to view its data.

There are no permissions, other than the default user admin, and it is not open by any other user or application.  I am already making sure that the database is opened non-exclusively and is not read only.  Here is an extract from the opening code with the password info etc removed (regdata is a data object on the form filled by the following code to pass the password to the database):

Private Sub Form_Load()
Dim db As Database
Dim RegSet As Recordset, growthSet As Recordset, dateset As Recordset

'Create recordset of data required for registration
regdata.DatabaseName = "c:\Database\myDB.mdb"
regdata.RecordSource = "registration"
regdata.Connect = ";Pwd=xxxxx"

Set db = OpenDatabase("c:\database\myDB.mdb", False, False)

Can anyone tell me what I am doing wrong here?

Question by:debbi_stott
  • 3
  • 2
  • 2
  • +1

Author Comment

ID: 2174217
Edited text of question.

Expert Comment

ID: 2174348
Could this be a funny system.mdw thingy?

If you haven;t tried this already as a solution try a

dbengine.systemdb = "x:\xxx\xxx\system.mdw"

as you may be using a corrupt or incorrect system.mdw file.


LVL 43

Expert Comment

ID: 2174350
I think that you need to set the workgroup file using

DBEngine.SystemDB = "system.mdw"

in order to validate permissions properly. On machines that have Access installed, this will already be available however if it is not installed then you will need to identify it.

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

LVL 43

Expert Comment

ID: 2174352
Simon got there first with the same thoughts, sorry to repeat!

Author Comment

ID: 2174632
I have tried adding a dbengine.systemdb = "x:\xxx\xxx\system.mdw" line in my code where the system.mdw file is in the VB application directory, and the system.mdw file was copied from my own machine, where the application and database where developed.  Now I get a new error message:

Run-time error '3028'
Can't start your application.  the workgroup information file is missing or opened exclusively by another user.

Accepted Solution

AnswerTheMan earned 300 total points
ID: 2175531
you need to install a MS file called
"Dataacc.exe" on the target machine.
that is all.
that file can be located in OFFICE97 CD, or can be D\L from many sites. just run any searcg engine for it.

Expert Comment

ID: 2175534
Does the user have read/write permissions for that directory? I have seen the same error when system.mdw is in c:\winnt\system32 and users can't make changes.

Good Luck


Author Comment

ID: 2176782
Thanks for all your help, but it actually turned out to be something much simpler.  In copying the database from the CD - the attributes on the database had been set to Read Only.  Removing this attribute enabled the application to run - even when I removed the system.mdw file and all reference to it in the application executable.

Even though your answers didn't actually solve the question - I really appreciate the hard thought and willingness to help.  You could not have known about the CD copy so I've marked you up as a gratefully good and acceptable answer.  It made me think and try things.  Thanks and cheers

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 3 hours left to enroll

590 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