ضع داخل زر الحفظ هذه الشيفرة .....
Dim db As DAO.Database
Dim rstFrom As Recordset
Dim rstTo As Recordset
Set db = CurrentDb
Dim RC, i, r As Integer
Set rstTo = db.OpenRecordset("tbl_add_fasl", dbOpenDynaset)
Set rstFrom = db.OpenRecordset("SELECT tbl_saf.id_m, tbl_saf.mr, tbl_saf.id_saf, tbl_saf.saf, tbl_saf.add_fasl FROM tbl_saf WHERE (((tbl_saf.id_m)=" & [Forms]![frm_m_r_f]![cb_mr] & "));", dbOpenDynaset)
rstFrom.MoveFirst: rstFrom.MoveLast
RC = rstFrom.RecordCount
rstFrom.MoveFirst
For i = 1 To RC
For r = 1 To rstFrom!add_fasl
rstTo.AddNew
rstTo!id_m = rstFrom!id_m
rstTo!mr = rstFrom!mr
rstTo!id_saf = rstFrom!id_saf
rstTo!saf = rstFrom!saf
rstTo!add_fasl = r
rstTo.Update
Next r
rstFrom.MoveNext
Next i
rstTo.Close
rstFrom.Close
Set rstTo = Nothing
Set rstFrom = Nothing
Set db = Nothing