Access Duplicate Table with properties like Lookup Field

Hi I have a table called “RA” and some fields are Lookup Field (hope it’s called that in english) so when I click on the cells in this column dropdown opens and I can select multiple things from another table.
I would like to duplicate the table “RA” 1-1 with properties, so if the table RA 2nd column is Lookup Field, the duplicate should also be Lookup Field.
I am quite new to access VBA and I have found a code on the internet. The table is duplicated but the properties Lookup Field etc. are not copied. I would appreciate some help.

here is my code so far, what i found on internet:

Sub DuplicateRATable()
    Dim db As DAO.Database
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Dim index As DAO.Index
    Dim rel As DAO.Relation
    Dim newTableName As String

    ' Set the current database
    Set db = CurrentDb()
    
    ' Define the new table name
    newTableName = "RA_Duplicate"
    
    ' Check if the new table already exists and delete if it does
    On Error Resume Next
    db.TableDefs.Delete newTableName
    On Error GoTo 0
    
    ' Copy the original table
    db.Execute "SELECT * INTO " & newTableName & " FROM RA", dbFailOnError
    
    ' Get the original table definition
    Set tdf = db.TableDefs("RA")
    
    ' Loop through the fields of the original table and copy combo box properties
    For Each fld In tdf.Fields
        On Error Resume Next
        ' Check if the field is a combo box
        If fld.Properties("DisplayControl").Value = acComboBox Then
            Dim prop As DAO.Property
            Dim newFld As DAO.Field
            Set newFld = db.TableDefs(newTableName).Fields(fld.Name)
            
            ' Copy combo box properties
            For Each prop In fld.Properties
                On Error Resume Next
                newFld.Properties(prop.Name).Value = prop.Value
                On Error GoTo 0
            Next prop
        End If
        On Error GoTo 0
    Next fld
    
    ' Copy indexes
    For Each index In tdf.Indexes
        On Error Resume Next
        ' Create a new index
        Dim newIndex As DAO.Index
        Set newIndex = db.TableDefs(newTableName).CreateIndex(index.Name)
        
        ' Add fields to the new index
        For Each fld In index.Fields
            newIndex.Fields.Append newIndex.CreateField(fld.Name)
        Next fld
        
        ' Copy index properties
        newIndex.Primary = index.Primary
        newIndex.Unique = index.Unique
        newIndex.IgnoreNulls = index.IgnoreNulls
        newIndex.Required = index.Required
        
        ' Append the new index to the new table
        db.TableDefs(newTableName).Indexes.Append newIndex
        On Error GoTo 0
    Next index
    
    ' Copy relationships
    For Each rel In db.Relations
        If rel.Table = tdf.Name Or rel.ForeignTable = tdf.Name Then
            On Error Resume Next
            Dim newRel As DAO.Relation
            Set newRel = db.CreateRelation(rel.Name, newTableName, rel.ForeignTable, rel.Attributes)
            
            For Each fld In rel.Fields
                newRel.Fields.Append newRel.CreateField(fld.Name)
                newRel.Fields(fld.Name).ForeignName = fld.ForeignName
            Next fld
            
            db.Relations.Append newRel
            On Error GoTo 0
        End If
    Next rel
    
    MsgBox "The table '" & newTableName & "' has been successfully duplicated."
End Sub

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật