في حدث زر حذف الفاتورة استخدم هذا ...... جرب ...
If MsgBox(" هـــل تـــريـــد حـذف فاتورة ", vbOKCancel, "! تـأكـيـد ") = vbOK Then
DoCmd.SetWarnings False
DoCmd.GoToRecord , , acFirst
For i = 1 To Me.Recordset.RecordCount
[Forms]![InvoiceHT_F]![InvoiceHT_SubF].SetFocus
DoCmd.RunSQL "UPDATE ItemsT SET ItemsT.QuantityA = Nz([ItemsT].[QuantityA])+Nz([Forms]![InvoiceHT_F]![InvoiceHT_SubF].[Form]![QuantityS]) WHERE (((ItemsT.ItemID)=Nz([Forms]![InvoiceHT_F]![InvoiceHT_SubF].[Form]![ItemID])));"
DoCmd.GoToRecord , , acNext
Next i
Me.Refresh
SysCmd acSysCmdClearStatus
End If
DoCmd.RunSQL "DELETE InvoiceTT.InvoiceNum FROM InvoiceTT WHERE (((InvoiceTT.InvoiceNum)=Nz([Forms]![InvoiceHT_F]![InvoiceNum])))"
DoCmd.SetWarnings True