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

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?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

debbi_stottAuthor Commented:
Edited text of question.
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.


TimCotteeHead of Software ServicesCommented:
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.

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

TimCotteeHead of Software ServicesCommented:
Simon got there first with the same thoughts, sorry to repeat!
debbi_stottAuthor Commented:
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.
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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

debbi_stottAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.