:: اكتب هذه الجملة بدل الجملة السابقة ... بالتوفيق
If DLookup("[id]", "details") = [SaleID] Then
MsgBox "هذه الفاتورة مسجلة مسبقا"
Exit Sub
Else
DoCmd.SetWarnings False
MsgBox "سيتم الحاق بيانات الفاتورة الى جدول التفاصيل"
DoCmd.RunSQL "INSERT INTO Details ( ID, sDate, CustomerName, ItemsName, Qy, Price, Total )SELECT Sale.SaleID, Sale.SaleDate, Sale.CustName, Sub.Items, Sub.Qy, Sub.Price, Sub.Total FROM Sale INNER JOIN Sub ON Sale.SaleID = Sub.SubID"
MsgBox "تم الالحاق"
DoCmd.SetWarnings True
End If