Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006

    Exclamation Unanswered: Duplicating Subform records

    Hello i am having problems duplicating records in a second level subform.

    if i use a form with a subform i can duplicate the records and subform records with an append query, using the form's tag property, however when i use a form with a subform containing a second level the tag property is not storing the records. I tried setting the focus of the subform to force the tab of the subform, but the only way i have been able to get it to work is to open another instance of the subform and call the primary key of the main form.

    any help is greatly appreciated.

  2. #2
    Join Date
    Aug 2006
    Here is the code i am using

    Private Sub btnDuplicateRecord_Click()
    Dim dbs As DAO.Database, Rst As DAO.Recordset
    Dim F As Form

    Set dbs = CurrentDb
    Set Rst = Me.RecordsetClone

    On Error GoTo Err_ btnDuplicateRecord _Click

    Me.Tag = Me![PHASE_ID]

    With Rst
    !Start_Date = Me!Start_Date
    !Phase = Me!Phase
    !End_Date = Me!End_Date
    !Task = Me!Task
    !Notes = Me!Notes

    .Move 0, .LastModified
    End With
    Me.Bookmark = Rst.Bookmark

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "Query1"
    DoCmd.SetWarnings True


    Exit_ btnDuplicateRecord _Click:
    Exit Sub

    Err_ btnDuplicateRecord _Click:
    MsgBox Error$
    Resume Exit_DuplicateRecord_Click:
    End Sub

  3. #3
    Join Date
    Aug 2006
    Sometimes all it takes is someone to tweak your memory a little. Thanks Des!

    I've posted the proper syntax below for the append query to copy the 1st and second level subform information into a new record in case anyone else is having the problem.

    NewNumber_ID: CLng([Forms]![Form1]![Tasks_subform].[Form]![PHASE_ID])


    The link below has a real good explaination of how to refer to various controls

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts