استخدم هذه الكود للتنبيه و التأكيد اولا قبل اضافة
Private Sub Command29_Click()
On Error GoTo g:
If MsgBox(" هل انت متأكد من اضافة سجلات", _
vbCritical + vbYesNo, _
"تنبيه") = vbNo Then
Exit Sub
Else
Dim i As Integer
Dim x As Date
Dim N As Integer
DoCmd.GoToRecord , , acNewRec
x = Forms![test1]![Date_M]
Me.no = Forms![test1]![no1] - 1
Me.Refresh
For i = Forms![test1]![no1] To Forms![test1]![no] + Forms![test1]![no1] - 1
N = DMax("[NO]", "Q1", "[ID]=" & Forms![test1]![id1])
Me.date1 = Forms![test1]![Date_M]
Me.serial = Forms![test1]![serial]
Me.date1 = DateAdd("d", Forms![test1]![no2], x)
x = Me.date1
Me.no = N + 1
DoCmd.GoToRecord , , acNext
Next i
DoCmd.Requery
End If
g: Exit Sub
End Sub