A
Anne
I have a error message The Jet Engine stopped the process because you and
another user are attempting to change data at the same time.
This is my code on the form.
I'm not sure 1) how to prevent this in the future and 2) how to correct the
corrupt files - I tried a compact and repair and that didn't work.
Option Compare Database
Private Sub cmdAddNew_Click()
On Error GoTo Err_cmdAddNew_Click
DoCmd.GoToRecord , , acNewRec
Exit_cmdAddNew_Click:
Exit Sub
Err_cmdAddNew_Click:
MsgBox Err.Description
Resume Exit_cmdAddNew_Click
End Sub
Private Sub cmdDelete_Click()
Dim intAnswer As Integer
Dim strDataEntered As String
On Error GoTo Err_cmdDelete_Click
intAnswer = MsgBox("Are you sure that you want to delete this record?",
vbOKCancel, "Delete Record")
'If answer is Cancel then don't delete record
If intAnswer = 2 Then
Exit Sub
End If
strDataEntered = ""
strDataEntered = strDataEntered & DatePerformed & TotalTravelTime &
TimeSpent & TotalKMS & ClosingComments & PartsUsed
If strDataEntered <> "" Then
MsgBox "You can't delete this record because data has been entered
into the grey are."
Exit Sub
End If
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_cmdDelete_Click:
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub
Private Sub cmdFind_Click()
On Error GoTo Err_cmdFind_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_cmdFind_Click:
Exit Sub
Err_cmdFind_Click:
MsgBox Err.Description
Resume Exit_cmdFind_Click
End Sub
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
DoCmd.GoToRecord , , acNewRec
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
WorkOrderType.Value = 1
End Sub
Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click
Dim stDocName As String
'Save record before printing in case it is a new record,
'Otherwise the page would be blank.
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
stDocName = "rptWorkOrder2"
DoCmd.OpenReport stDocName, acNormal, , "WorkorderID=" & Me.WorkorderID
Exit_cmdPrint_Click:
Exit Sub
Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
Private Sub Print_Click()
End Sub
another user are attempting to change data at the same time.
This is my code on the form.
I'm not sure 1) how to prevent this in the future and 2) how to correct the
corrupt files - I tried a compact and repair and that didn't work.
Option Compare Database
Private Sub cmdAddNew_Click()
On Error GoTo Err_cmdAddNew_Click
DoCmd.GoToRecord , , acNewRec
Exit_cmdAddNew_Click:
Exit Sub
Err_cmdAddNew_Click:
MsgBox Err.Description
Resume Exit_cmdAddNew_Click
End Sub
Private Sub cmdDelete_Click()
Dim intAnswer As Integer
Dim strDataEntered As String
On Error GoTo Err_cmdDelete_Click
intAnswer = MsgBox("Are you sure that you want to delete this record?",
vbOKCancel, "Delete Record")
'If answer is Cancel then don't delete record
If intAnswer = 2 Then
Exit Sub
End If
strDataEntered = ""
strDataEntered = strDataEntered & DatePerformed & TotalTravelTime &
TimeSpent & TotalKMS & ClosingComments & PartsUsed
If strDataEntered <> "" Then
MsgBox "You can't delete this record because data has been entered
into the grey are."
Exit Sub
End If
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_cmdDelete_Click:
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub
Private Sub cmdFind_Click()
On Error GoTo Err_cmdFind_Click
Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Exit_cmdFind_Click:
Exit Sub
Err_cmdFind_Click:
MsgBox Err.Description
Resume Exit_cmdFind_Click
End Sub
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
DoCmd.GoToRecord , , acNewRec
Exit_cmdAdd_Click:
Exit Sub
Err_cmdAdd_Click:
MsgBox Err.Description
Resume Exit_cmdAdd_Click
End Sub
Private Sub Form_BeforeInsert(Cancel As Integer)
WorkOrderType.Value = 1
End Sub
Private Sub cmdPrint_Click()
On Error GoTo Err_cmdPrint_Click
Dim stDocName As String
'Save record before printing in case it is a new record,
'Otherwise the page would be blank.
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
stDocName = "rptWorkOrder2"
DoCmd.OpenReport stDocName, acNormal, , "WorkorderID=" & Me.WorkorderID
Exit_cmdPrint_Click:
Exit Sub
Err_cmdPrint_Click:
MsgBox Err.Description
Resume Exit_cmdPrint_Click
End Sub
Private Sub Print_Click()
End Sub