>The only way I can re-open Access is by re-booting.

Signature
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony,
Thank your for your reply.
Clossing the process works, thanks. But I still have the problem because it
happens every time I use the EditRecord command on my subform.
I am using Access 2002, Windows 2000 profesionnal. I included the procedure
that I believe is the cause of this problem. The procedure is called from
AddRecord or EditRecord command buttons. I displays an unbound input form,
waits for input, after OKed is press, the code I included here assigns the
inputs to a recordset of a subform. The subform's recordsource is set to the
SQLstr$ that retrieves records from one table. The SQLstr only retrieves
records that are for one user in one week period, and it is updated each
time that the week date changes.
Closing the MSACCESS.EXE process does releases the LDB and MDB. I like to
get rid of this problem because it is very predictable. It happens each time
I use the EditRecord command in the subform. The form's lock property is set
to 'edited record.' I don't know if record locking and exiting has something
to do with this.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub Get_Record(NewRecord As Boolean)
' display dialog form and assign data to bound record.
''''''''''''''''''''''''''''''''''''''''
' Plan to Pass arguments to the frmSelectProject form:
' Load the form first
' Call and pass variables to Initialize procedure on the frmSelectProject
form.
'
'
Dim Cost_Type As Variant
'Cost Types: 1 = [Receiver CCtr]; 2 = [Rec Int order]; 3 = [Rec WBS-E]
Const DefaultCostType = 3 ' Default cost type when all fields are NULL.
Dim cnn As ADODB.Connection
Dim InTrans As Boolean
If (NewRecord) Then ' new record needs initialization
' jose you need to pass Dialog Title for New record?
Arguments$ = "NewRecord," & DefaultCostType & ",,," &
Round_Date(Me.Parent.Doc_Date) & ",R&DLBR," & ""
Else ' editing record
Me.Recordset.Bookmark = Me.Bookmark ' Syncronize to Form
'TEST FOR LOCKED RECORD GOES HERE (new records should never be locked)
d1 = Me.RecordLocks
d2 = Me.Recordset.EditMode
On Error GoTo ErrGet_Record
Me.Recordset.edit ' This caoused error 3188; locked record can't be
updated.
' d3 = Me.Recordset.LockType ' Error: property not supported.
With Me.Recordset
Cost_Type = (-1 * Not IsNull(.Fields("Receiver CCtr"))) _
- (2 * Not IsNull(.Fields("Rec Int order"))) _
- (3 * Not IsNull(.Fields("Rec WBS-E")))
If Cost_Type = 0 Then Cost_Type = DefaultCostType ' Default cost
type when all fields are NULL.
RecNumber = Me.CurrentRecord
End With
Arguments$ = RecNumber & "," & Cost_Type & "," & cmbProjectNumber &
"," & Quantity & "," & Doc_Date & "," & Activity_type & "," &
Text_max_50_digits
End If
DoCmd.OpenForm "frmSelectProject", , , , , acDialog, Arguments$ '
acDialog halts code execution until the form is dismissed.
'Code continues only after frmSelectProject is Oked or cancelled by the
user.
With Form_frmSelectProject
If FormIsLoaded("frmSelectProject") Then
Set cnn = CurrentProject.Connection
' Set cnn = Me.Recordset.ActiveConnection
cnn.BeginTrans
dfd = Me.Recordset.EditMode
If NewRecord Then
Me.Recordset.AddNew ' Open a new Record
Me.Recordset("Personnel #") = Me.Parent.Emp_ID 'Required field
Me.Recordset("Send CCtr") = Me.Parent.Send_CCtr_head 'Required
field
Me.Recordset("Entry TimeDate") = Now()
' Me.Recordset.Update
' Me.Recordset.Bookmark = Me.Bookmark 'Syncronize to recordset
' DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
Else ' Open record for editing
Me.Recordset.Bookmark = Me.Bookmark 'Syncronize to form
(Orininally done above)
Me.Recordset.edit
If IsNull(Me.Recordset("Entry TimeDate")) Then
Me.Recordset("Entry TimeDate") = Now()
End If
End If
Assign_to_Project ' For new records Assign_to_Project is to execute
after saving the record.
For xxx = 1 To 10000
'wait loop
Next xxx
'assigns values to current record in Me form.
Me.Recordset("Doc Date") = Round_Date(.Doc_Date)
Set dt = New DateClass
Me.Recordset("Posting date") =
dt.CurrentMonthEnd(Me.Recordset("Doc Date"))
Set dt = Nothing
Me.Recordset("Quantity") = .Qty
Me.Recordset("Activity type") = .Activity_type
Me.Recordset("Text max 50 digits") = .Comments
Me.Recordset.Update
DoCmd.Close acForm, "frmSelectProject", acSaveNo
cnn.CommitTrans
Me.Recordset.Bookmark = Me.Bookmark 'Syncronize to recordset
Else
' dialog form was canceled
End If
End With
ExitGet_Record:
Me.AllowAdditions = False
Refresh_and_Size (Me.Parent.ActiveControl) ' Passes subform control
Exit Sub
ErrGet_Record:
If Err.Number = 3188 Then 'Error 3188; locked record can't be updated.
Mess$ = "This entry is being edited by another user" & vbCrLf & vbCrLf _
& "System's eror: " & Err.Number & "--" & Err.Description
MsgBox Mess$, vbInformation, "Edit Record"
End If
GoTo ExitGet_Record
End Sub
> >I have finished a new input form that has recordsource equal to an SQL string
> >that retirves records for one week for one user. The form locks the record
[quoted text clipped - 15 lines]
>
> Tony
Tony, this is the message I posted on a different post I made today.
I have an access 2002 database. I use a form to display records basing
resultset = SQLstr$. The form essentially displays records for a given user
on a specific week. Each time the user changes a week date, the SQLstr$
changes and the new set of records are displayed. The form has an edit
button that opens an unbound form (frmSelectProject) to collect edits for a
record. After the input form is OKed, I assign the inputs to the current
record of the displaying form. Editing of the record works fine. After I
close all forms and then quit Access, The LDB file closes as it should. The
problem starts right after I try to open the Access DB file for a second
time. When I lunch the DB file, I see the greeting message (msgbox) that I
just click OK, and then the database does not show and I am send back to file
Explorer where I see the LDB file next to the database file. I cannot delete
any of two files (.ldb or .mdb). I use Ctrl+Alt+Del and find the process of
MSACESS.EXE running. I force it to close, and then I can get back into the
database.
I plan to have this database be shared by about 30 users, but currently this
problem is on my test copy that resides in my C drive and I even tried a
split database. I don't want to release this program if after quitting
Access one time the second time the DB file won't open.
I can infer that the problem lies in the editing of the record. I suspect
the recordset.edit or recordset.update along with record locking may have
something to do. Locking is set to "edited record" and seems to work fine on
the display form.
I guess my question is how I can avoid having the DB file being
un-accessible after the first user.
Aaron Kempf - 27 Apr 2007 22:02 GMT
yeah if you want to get rid of random errors-- then move to Access Data
Projects
> Tony,
>
[quoted text clipped - 17 lines]
> to 'edited record.' I don't know if record locking and exiting has something
> to do with this.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''
> Private Sub Get_Record(NewRecord As Boolean)
> ' display dialog form and assign data to bound record.
[quoted text clipped - 152 lines]
> I guess my question is how I can avoid having the DB file being
> un-accessible after the first user.