Hi All
I've a problem. I'm trying to develop a human resource management system for
our company. The project is almost complete now and I'm just applying some
final touches.
In the system, I don't want an employee to be completely deleted from the
system when they resign, retire, die or are dismissed . What I want is just
to mark them as deleted. Here is part of the code I'm using
Sub DeleteEmployee()
On Error GoTo Err_cmdDeleteEmployee
Dim stCriteria As String, stSQL As String, stFullName As String
Dim stConfirmDelete As String, stReason As String
stFullName = FirstName & " " & Surname
stReason = DLookup("DeleteReason", "DeleteReasons", "ID = " &
Me.DeleteReason)
stConfirmDelete = "Are you sure you want to delete " & stFullName & " and
the reason is " & Chr(10) & Chr(13)
stConfirmDelete = stConfirmDelete & stReason
stCriteria = "StaffDetails.EmpID = '" & Me.EmpID & "'"
If MsgBox(stConfirmDelete, vbCritical + vbYesNo + vbDefaultButton2,
GetCompany) = vbYes Then
stSQL = "UPDATE StaffDetails SET StaffDetails.Deleted = -1 WHERE " &
stCriteria & ";"
DoCmd.RunSQL stSQL
Else
stSQL = "UPDATE StaffDetails SET StaffDetails.DeleteReason = " & Chr(34)
& Chr(34) & " WHERE " & stCriteria & ";"
DoCmd.RunSQL stSQL
End If
Me.Refresh
...
Now the problem is that when I confirm Delete by clicking on Yes Access
tells me that another user has changed the record since I started editing it
and that if I save the record I'll overwrite the changes made by the other
user. I'm then given 3 choices: Save Record, Copy to Clipboard and Drop
Changes. If I select Save Record, the field Deleted is not updated to True.
I'm completely stuck. At one point it did work as expected but thereafter
nope. It is installed on my pc only.
Any assistance will be highly appreciated.
Regards
Liveson
Please zip all files prior to uploading to Files section.
Yahoo! Groups Links
SPONSORED LINKS
| Microsoft access database | Database development software | Database management software |
| Database software | Inventory database software | Membership database software |
YAHOO! GROUPS LINKS
- Visit your group "ms_access" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
