Another Run-Time error '3051' with Access and VB6
Posted on 1999-11-01
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?