اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر

السلام عليكم 

بالمرفق طريقة التحديث والإضافة من جدولين باستخدام أكود Recordset 

كود التحديث :

Dim i As Integer
Dim ii As Integer
Dim RC As Integer
Dim RC1 As Integer
Dim A2 As Variant
Set rs = CurrentDb.OpenRecordset("Select * From Temp3")
rs.MoveLast: rs.MoveFirst
RC = rs.RecordCount
For i = 1 To RC
A2 = rs!f2
' يجب أن يكون نوع الحقل المربط بين الجدولين رقم
        Set rst = CurrentDb.OpenRecordset("SELECT * From Temp4 WHERE ID =" & rs.ID & "")
        rst.Edit
        rst.ID = rs.ID
        rst.f1 = rs.f1
        rst.f2 = rs.f2
        rst.F3 = rs.F3
        rst.F4 = rs.F4
        rst.F5 = rs.F5
        If Len(A2 & "") <> 0 Then rst!F6 = "******" & Right(rs.f2, 4)
        rst.Update

rs.MoveNext
Next i
Set rst = Nothing
Set rs = Nothing
MsgBox "OK"

 

كود الإضافة :

Dim i As Integer
Dim ii As Integer
Dim RC As Integer
Dim RC1 As Integer
Set rs = CurrentDb.OpenRecordset("Select * From Temp4")
rs.MoveLast: rs.MoveFirst
RC = rs.RecordCount
For i = 1 To RC

' يجب أن يكون نوع الحقل المربط بين الجدولين رقم
        Set rst = CurrentDb.OpenRecordset("SELECT * From Temp5 WHERE ID =" & rs.ID & "")
        rst.AddNew
        rst.ID = rs.ID
        rst.f1 = rs.f1
        rst.f2 = rs.f2
        rst.F3 = rs.F3
        rst.F4 = rs.F4
        rst.F5 = rs.F5
        rst.F6 = rs.F6
        rst.Update
        
rs.MoveNext
Next i
Set rst = Nothing
Set rs = Nothing
MsgBox "OK"

وبالتوفيق :rol:

Recordset.mdb

  • Like 6

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • اضف...

Important Information