C
Charles
I have 2 tables joined together in a one-to-many relationship. Together
they represent transaction detail in a sales environment. On a form
attached to the tables, using the Command Button Wizard (Duplicate Record),
I created a command button that creates a new record by duplicating the
record the user is currently viewing. The problem is that I can't get the
data in the subtable to duplicate. Right now, only the data from the main
table gets duplicated and the user has to manually duplicate the transaction
detail of the subtable. Does anyone know how to get the subtable records to
be duplicated as well?
Below is the code created by the wizard in Access 2000:
Private Sub cmdDuplicateRecord_Click()
On Error GoTo Err_cmdDuplicateRecord_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Exit_cmdDuplicateRecord_Click:
Exit Sub
Err_cmdDuplicateRecord_Click:
MsgBox Err.Description
Resume Exit_cmdDuplicateRecord_Click
End Sub
Also, is this code the best way to duplicate a record?
they represent transaction detail in a sales environment. On a form
attached to the tables, using the Command Button Wizard (Duplicate Record),
I created a command button that creates a new record by duplicating the
record the user is currently viewing. The problem is that I can't get the
data in the subtable to duplicate. Right now, only the data from the main
table gets duplicated and the user has to manually duplicate the transaction
detail of the subtable. Does anyone know how to get the subtable records to
be duplicated as well?
Below is the code created by the wizard in Access 2000:
Private Sub cmdDuplicateRecord_Click()
On Error GoTo Err_cmdDuplicateRecord_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Exit_cmdDuplicateRecord_Click:
Exit Sub
Err_cmdDuplicateRecord_Click:
MsgBox Err.Description
Resume Exit_cmdDuplicateRecord_Click
End Sub
Also, is this code the best way to duplicate a record?