Microsoft KB Archive/274211

= PRB: Error Message 3734 Occurs When You Repeatedly Open and Close MDB File =

Article ID: 274211

Article Last Modified on 7/14/2004

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Access 2000 Standard Edition
 * Microsoft Windows XP Home Edition
 * Microsoft Windows XP Professional

-



This article was previously published under Q274211



SYMPTOMS
If you repeatedly open and close a Microsoft Access database (MDB) in a multiuser situation, the following 3734 run-time error message may occur:

The database has been placed in a state by user 'Admin' on machine 'machinename' that prevents it from being opened or locked.



CAUSE
Jet locks a block of 256 bits in the MDB header. Included in this block of bits are bits that indicate a &quot;passive shutdown&quot;, which causes the error message described in the &quot;Symptoms&quot; section to occur. You may have users that open and close the MDB file rapidly and the bits are not getting unlocked quickly enough. When a user tries to open the MDB file, if the program is not able to read the bits, Jet assumes that the user is in a &quot;passive shutdown&quot; or &quot;admin mode&quot;, and therefore will not let the user open the MDB file.



RESOLUTION
Repeatedly opening and closing a Microsoft Access database is not recommended. Open the database once at the beginning of the application, and then close the database at the end of the application.



STATUS
This behavior is by design.



MORE INFORMATION
The 3734 error code is new with Microsoft Access 2000. Jet 4.0 introduces a new feature called Connection Control. Error 3734, associated with this feature, normally occurs when you try to open a database if the database is opened exclusively by another user. Databases are opened exclusively when design changes are being made. However, no design changes are being made to the database in this situation when the error occurs.

NOTE: For more information about Connection Control, please refer to the article listed in the &quot;References&quot; section.

Steps to Reproduce Behavior
 Open a Standard EXE in Visual Basic. From the Project menu, click References and add a reference to the Microsoft DAO 3.6 Object Library. Size the form so that you can run 12 instances of the form on your desktop. Place the following items on a form and name them according to the following table:

 Set the interval for the timer to 1000.</li>  Paste the following code in the code window of the form: Option Explicit Dim sDatabasePath  As String Dim bBypass        As Boolean Dim lCounter       As Long Private Sub Command1_Click lCounter = 0 Timer1.Enabled = Not Timer1.Enabled DoEvents If Command1.Caption = &quot;Start Test&quot; Then Command1.Caption = &quot;End Test&quot; txtReturn = &quot;&quot; lCounter = 0 Else Command1.Caption = &quot;Start Test&quot; End If End Sub

Private Sub Form_Load Dim db As DAO.Database On Error GoTo ErrorOut If Len(Trim$(sDatabasePath)) = 0 Then sDatabasePath = App.Path & &quot;\NWIND40.MDB&quot; If Dir$(sDatabasePath) = &quot;&quot; Then MsgBox &quot;Cannot locate the NWIND.MDB database in the path.&quot; & vbCr & vbCr & &quot;Cannot continue!&quot;, 0 + 16 End End If

Set db = Workspaces(0).OpenDatabase(sDatabasePath, False, False, &quot;;pwd=admin&quot;) On Error Resume Next 'in case there is no table to delete db.Execute &quot;drop table serialnumber&quot; On Error GoTo 0 'turn off above ON ERROR command db.Execute &quot;create table serialnumber (sn number)&quot; db.Execute &quot;insert into serialnumber (sn) values (1)&quot; db.Close Set db = Nothing Timer1.Enabled = False Exit Sub ErrorOut: MsgBox Err & vbCr & Error End End Sub Private Sub Timer1_Timer Dim db             As Database Dim RS             As Recordset Dim sSQL           As String On Error GoTo ErrorOut If Len(Trim$(sDatabasePath)) = 0 Then sDatabasePath = App.Path & &quot;\NWIND40.MDB&quot; If Dir$(sDatabasePath) = &quot;&quot; Then MsgBox &quot;Cannot locate the NWIND.MDB database in the path.&quot; & vbCr & vbCr & &quot;Cannot continue!&quot;, 0 + 16 End End If

Set db = Workspaces(0).OpenDatabase(sDatabasePath, False, False, &quot;;pwd=admin&quot;) lCounter = lCounter + 1 Me.Caption = &quot;Database Volume Simulator (&quot; & CStr(lCounter) & &quot;)&quot; DoEvents If chkIncludeSN.Value = 1 Then sSQL = &quot;SELECT * FROM [SERIALNUMBER]&quot; Set RS = db.OpenRecordset(sSQL, dbOpenDynaset) RS.LockEdits = True DBEngine.Idle dbRefreshCache RS.Edit RS![sn] = RS![sn] + 1 lCounter = RS![sn] RS.Update RS.Close End If   sSQL = &quot;SELECT * FROM [CUSTOMERS] &quot; Set RS = db.OpenRecordset(sSQL, dbOpenDynaset) RS.LockEdits = True DBEngine.Idle dbRefreshCache If RS.RecordCount > 0 Then RS.Edit Else RS.AddNew End If   RS![CompanyName] = &quot;1234567890&quot; RS![ContactName] = &quot;asdf&quot; RS![contacttitle] = &quot;fgfg&quot; RS![Address] = &quot;123 dfgdfgdg&quot; RS![City] = &quot;sddfsd&quot; RS![Region] = &quot;12&quot; RS![PostalCode] = &quot;SDFD&quot; RS![country] = &quot;test&quot; RS![Phone] = &quot;Ban-Name&quot; RS![Fax] = &quot;Ban ddres&quot; RS.Update RS.Close db.Close

Exit Sub ErrorOut: Me.SetFocus DoEvents txtReturn = txtReturn & CStr(Err) & &quot; - &quot; & Error & Chr$(13) & Chr$(10) txtReturn.SelStart = Len(txtReturn) DoEvents End Sub

</li> Create an executable, and then run 12 instances of the form on the desktop.</li> By default, the check box should be selected.</li> Press the Start Test button on each form and you will begin to see that errors are returned to the multiline list box.</li></ol>

Most of the error messages will be 3260 errors; however, other locking errors also appear. After a few minutes you will begin to see the 3734 error messages.

<div class="references_section">