السلام عليكم اخواني
Ms Access
.واذا لقاها فارغة يقوم بالعملية Update عندي مشكلة كود يقوم بفحص قيمة ليست فارغة في حقل لجدول بين تاريخين , اذا حصل على قيمة ليست فارغة لا يقوم بعملية
.هو الحقل المراد بأن يكون فارغا قبل الحذف واذا كان فارغا تتم العملية بنجاح SenderID
txtDF بمعنى ما بعد التاريخ في النمزذج بإسم Criteria هو حقل ال DDate
أرجوا من اخواني الاعزاء المساعدة
شكرا جزيلا مقدما
Private Sub cmdUpdate_Click()
On Error GoTo errHandler
On Error GoTo errHandler
DoCmd.Save
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RefreshRecord
Me.txtStartDate.Requery
Me.txtDF.Requery
Beep
Dim rs As Variant
rs = DLookup("[SenderID]", "DeptSeq", "[DDate] >= #" & txtDF & "#")
If Not IsNull(rs) Then
MsgBox Prompt:="One or more ""Sent Dates"" exist in the date range selected for deletion.", buttons:=vbOKOnly, Title:="Can't Delete Dates with Sent Items"
Else
If IsNull(rs) Then
If MsgBox("You are about to execute a major operation ! Do you really want to continue ?" & vbCrLf, vbYesNo, "Major Operation") = vbNo Then
Undo
MsgBox "Your operation execution is canceled !", vbOKOnly, "Operation Canceled"
Else
DoCmd.SetWarnings False
DoCmd.OpenQuery "QryDelete", , acEdit
DoCmd.SetWarnings True
DoCmd.RunCommand acCmdRefresh
DAOAdding
On Error Resume Next
MsgBox "Your operation execution is completed successfully.", vbOKOnly, "Successful Operation"
End If
End If
End If
ExitProc:
Exit Sub
errHandler:
MsgBox Prompt:=Err & ": " & Err.Description, buttons:=vbOKOnly, Title:="Error"
Resume
End Sub