Duplicating records

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paolo

    #1

    Duplicating records

    I know I should not be doing this but I find it very useful.
    I have this code that duplicates some records in a table named
    CLIENTS.I use a form named CLIENTS to add data to this table.


    Private Sub Command1_Click( )
    Dim MyDb As DAO.Database, MyRs As DAO.Recordset
    Dim strCode As String
    Dim strFilter As String
    Set MyDb = CurrentDb
    Set MyRs = MyDb.OpenRecord set("CLIENTS")
    MyRs.AddNew
    MyRs!SSN = Forms!CLIENTS!F ILENUMBER
    MyRs.Update
    strCode = DMax("[ID]", "Clients")
    strFilter = "(([ID] = " & strCode & ")) "
    DoCmd.ApplyFilt er , strFilter
    End Sub

    What I would now like is to be able to duplicate the field FILENUMBER
    to a different table named GUESTS which also has a field named
    FILENUMBER.

    I would like to add this code to the after update event.

    Any help?
Working...