After searching the group and the net, I just can't believe after all
this work I'm going to have to sit through three Write Conflict
messages when I want to roll back and delete a record.
The action rolls back a new hire record, deleting it from a joining
table between employee and position - tblPosEmpRecord .
It's a many to many join.
The new hire action updates the employee with a new position and logs
it in the connecting record table.
If a user accidentally assigns the wrong position, they will need to
rollback the change and erase the connecting record, store a null in
the employee tables' position number, and store 'vacant' in the
position table for that record.
Here's the rollback:
Public Sub rollback()
On Error Resume Next
Dim temp_pos As Long
Dim temp_title As Long
Dim temp_salary As Currency
temp_pos = Forms!frmperson nelmain!frmTAB1 part4!curPos
temp_title = Forms!frmperson nelmain!frmTAB1 part4!curTitle
temp_salary = Forms!frmperson nelmain!frmTAB1 part4!curSalary
Forms!frmperson nelmain![tblPosition.Pos StatusID] = 2 'vacant
MsgBox "pos=vacant "
If Forms!frmperson nelmain.Dirty Then
Forms!frmperson nelmain.Dirty = False
End If
If Forms!frmperson nelmain!frmTAB1 part4!Designati on = 11 Then
'<----rollback for new hire!
Forms!frmperson nelmain![tblEmployee.Pos ID] = Null
If Forms!frmperson nelmain.Dirty Then
Forms!frmperson nelmain.Dirty = False
End If
Forms!frmperson nelmain![cboHistFilt] = Null
MsgBox "new hire rollback REcord Deleted"
Forms!frmperson nelmain!EmpStat us = 0 'inactive
Forms!frmperson nelmain!frmTAB1 part4!proPos.Re query
Exit Sub
End If
Forms!frmperson nelmain!frmTAB1 part4!PosID = temp_pos
Forms!frmperson nelmain![tblEmployee.Pos ID] = temp_pos
Forms!frmperson nelmain![tblPosition.Job ClassID] = temp_title
Forms!frmperson nelmain!Monthly Salary = temp_salary
Forms!frmperson nelmain![cboHistFilt] = temp_pos
Forms!frmperson nelmain![tblPosition.Pos StatusID] = 1 'filled
MsgBox "gothere? rollback"
If Forms!frmperson nelmain.Dirty Then
Forms!frmperson nelmain.Dirty = False
End If
Forms!frmperson nelmain!frmTAB1 part4!proPos.Re query
End Sub
It works, I just don't like the three WRITE CONFLICT messages popping
off. It's very obnoxios.
Thanks,
Christian