وعليكم السلام ورحمة الله وبركاته ..
يبدو أنك تريد نقل الأفكار إلى مشروعك مباشرةً .. صحيح ؟؟
طيب ، ومشاركةً مع الأستاذ @kkhalifa1960 ، هذه فكرة أخرى من خلال زر الحذف نفسه . حيث استعملت الفكرة التالية في الزر فقط :-
Private Sub Btn_Del_Click()
Dim Response As VbMsgBoxResult
Dim t4Value As Variant
Dim userName As String
Dim computerName As String
Dim sql As String
Response = MsgBox("هل أنت متأكد أنك تريد حذف هذا السجل؟", vbYesNo + vbQuestion + vbMsgBoxRight, "")
If Response = vbYes Then
If IsNull(Me.T4) Or Me.T4 = "" Then
MsgBox "لا يمكن تسجيل الحذف لأن الحقل T4 فارغ", vbExclamation + vbMsgBoxRight, ""
Exit Sub
End If
t4Value = Me.T4
userName = Environ("Username")
computerName = Environ("ComputerName")
sql = "INSERT INTO hestable (oldrec, [User], Comname, curdata) " & _
"VALUES ('" & Replace(t4Value, "'", "''") & "', '" & Replace(userName, "'", "''") & "', '" & Replace(computerName, "'", "''") & "', Now());"
On Error GoTo ErrHandler
CurrentDb.Execute sql, dbFailOnError
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
MsgBox "تم إلغاء عملية الحذف", vbInformation + vbMsgBoxRight, ""
End If
Exit Sub
ErrHandler:
MsgBox "حدث خطأ أثناء تسجيل الحذف", vbCritical + vbMsgBoxRight, "خطأ"
End Sub
TrackDelete.zip