I am working on a fairly complex many-to-many database and want to add a feature to allow a user to copy the current record as a new one by clicking a button on the form.
It is set up as a main form bound to a query (to calculate time) and there are 6 subforms, each bound to a separate table. Each subform is Child/Master linked by the same primary key to the main form. This is to support the many-to-many relationship of the information collected with each record. (Essentially the user is selecting a number of options from 6 different lists for each record).
I have the button set up to duplicate the main form record with this (modified wizard-generated) code, which works swimmingly:
It is set up as a main form bound to a query (to calculate time) and there are 6 subforms, each bound to a separate table. Each subform is Child/Master linked by the same primary key to the main form. This is to support the many-to-many relationship of the information collected with each record. (Essentially the user is selecting a number of options from 6 different lists for each record).
I have the button set up to duplicate the main form record with this (modified wizard-generated) code, which works swimmingly:
Me.AllowAdditions = True 'added because I have controls in place that limit data entry on the form
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70
I need the user to be able, with the same click, to duplicate the records in the related tables and I am not sure what the method would be for that. Can you help? Thanks in advance!!DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70
Last edited: