Results 1 to 5 of 5
  1. #1
    SHAMI is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2023
    Posts
    9

    Updating From One Table to Another Based on an ID Match


    Hi all comrades

    please , how to update a table2 record based on alter a similar record in table1 with specified Id by a vba or query statment ?

    Example in attachment .
    Attached Files Attached Files

  2. #2
    CarlettoFed is offline Competent Performer
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2019
    Posts
    274
    It makes no sense to have two tables that are the same.

  3. #3
    SHAMI is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2023
    Posts
    9
    the sense is (The second table is linked table from a network server ....)

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by SHAMI View Post
    the sense is (The second table is linked table from a network server ....)
    I still don't understand the need or two tables that are the same.
    Why not use the linked table as the record source of the form?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    SHAMI is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2023
    Posts
    9
    thanks you all
    solved just now by a close friend with vba code .
    Code:
    Private Sub Sv_Click()  
        Dim db As DAO.Database
        Dim rst As DAO.Recordset
        
        Set db = CurrentDb
        Set rst = db.OpenRecordset("Select * From Table2")
        
        rst.FindFirst "ID=" & (Me.ID)
     
        If Not rst.NoMatch Then
            rst.Edit
            rst!DName = Me.DName
            rst!Age = Me.Age
        
            rst.Update
        End If
        
        rst.Close
        Set rst = Nothing
        Set db = Nothing
    End Sub

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 04-11-2022, 02:52 PM
  2. Replies: 2
    Last Post: 03-07-2019, 02:27 PM
  3. Update table based on closest match on date
    By dalahans in forum Queries
    Replies: 6
    Last Post: 06-07-2018, 07:50 AM
  4. Replies: 16
    Last Post: 03-13-2012, 03:47 PM
  5. Replies: 1
    Last Post: 11-05-2010, 04:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums