vb conflict to open DB already open with Access (error 3356)

vb conflict to open DB already open with Access (error 3356)

Post by bob bet » Sat, 02 Dec 2000 04:00:00



the access db is opened by user belonging to a group that has read only
permissions to the database and relevant tables

the vb 4.0 program tries to open the same database with:
Set Db = DBEngine.Workspaces(0).OpenDatabase("dbName", dbReadOnly)
Set RecSet = mastDb.OpenRecordset("prodmast", dbOpenTable, dbReadOnly)

the open fails with error 3356 which sez the db is open by user soandso on
machine machineName

obviously i don't understand how to get concurrent use of the db, for even
read only, can anybody help????

 
 
 

vb conflict to open DB already open with Access (error 3356)

Post by Douglas J. Steel » Mon, 04 Dec 2000 04:00:00


The problem is likely that you haven't given your users sufficient access to
the folder in which the database resides.

Whenever a database is opened, Access tries to put the locking file (.LDB)
in the same folder as the .MDB. As each subsequent users opens the database,
Access writes some information to this locking file. When the last user logs
out of the database, Access deletes the locking file. Therefore, your users
require RWXD on the folder.

The exception to this is if you open the database as read-only AND
exclusive. Under that combination, Access doesn't bother to write the LDB.
And, despite how it sounds, multiple people can open the database in this
way at the same time.

HTH

--

Doug Steele, Microsoft Access MVP
Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://I.Am/DougSteele/


Quote:> the access db is opened by user belonging to a group that has read only
> permissions to the database and relevant tables

> the vb 4.0 program tries to open the same database with:
> Set Db = DBEngine.Workspaces(0).OpenDatabase("dbName", dbReadOnly)
> Set RecSet = mastDb.OpenRecordset("prodmast", dbOpenTable, dbReadOnly)

> the open fails with error 3356 which sez the db is open by user soandso on
> machine machineName

> obviously i don't understand how to get concurrent use of the db, for even
> read only, can anybody help????


 
 
 

1. Runtime Error 3356 - DB open exclusively w/ Access

I have a project that mainly uses ado through code.  I do have a couple
of forms that use the ado data control though.  Anytime I open and then
close a form that uses the control, and then I execute the following
code from another form:

DBEngine.CompactDatabase gsDBPath, txtDB.Text

I then get the following error (provided I previously opened the form
which uses the ado data control:

"You attempted to open a database that is already opened exclusively by
user <name> on machine <name>. Try again when the database is available.
(Error 3356)"

I open the form using the following code:

---
            With frmEditProcess.Adodc1
                .ConnectionString = _
                "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security
Info=False;" _
                & "Data Source=" & gsDBPath
                .CommandType = adCmdText
                .RecordSource = "SELECT * FROM tsoProcess ORDER BY
CustomerNumber"
                .Refresh
            End With
---

In frmEditProcess, I also have:

---
Private Sub Form_Unload(Cancel As Integer)
Adodc1.Recordset.Close
Set frmEditProcess = Nothing
End Sub
---

I am convinced it has something to do with this form.  In fact, after
opening this form, I must restart VB in order to compact the access
database.  Also, normally when I use ado through code, I set the
recordset = Nothing but I do not know if I can/should do that when using
the control.

Thanks in advance for any suggestions,

Jim

2. Nobody has a suggestion?

3. Mail merge from Access try to open an already open DB

4. OFA 4.8 / Express 5 database crash problem

5. error 3050 - couldn't open file / vb 4.0 trying to open access database

6. MS Access to SQL Server

7. Error opening file (already opened)

8. ANN: Apollo ASP Released To Beta, and other news

9. Access (already opened) DB from a DLL module

10. VB tries to Open MS Access DB [ERROR]

11. Preventing a from from being opened - if already open

12. Clear Excel data using VB Script - File Already Open

13. Mdb file backup problem = > error code 3356