By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,083 Members | 1,608 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,083 IT Pros & Developers. It's quick & easy.

Duplicating Records with Subform containing duplicate values...

P: n/a
I have a Form where I have created a duplicate record button, no
problem...

The subform is where my problem lies. The subform displays data
matching the mainform's ID, these two values are linked. The subform
has no primary key, since there are multiple matching entries.
Basically the mainform displays Customer info + order totals, and the
subform displays the products.

When I goto duplicate the record, the ID from the duplicated record
gets pasted into the new record in the subform, therefore not
displaying on the subform. I cant imagine it would be especially
difficult to change these values after the paste and not have them
overwrite the previous value, but I am literally out of ideas.

Here is my duplicate code, straight from MS:

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste
Append

Any ideas?

Aug 1 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Oh, do it the easy way. Add a primary key (autonumber) to your
subform's recordsource. if you grab the primary key of the old record,
you can then insert it after adding the new record. you'd just get
both PK's and then insert into the subform table using a paramterized
SQL statement.

But who would ever want to use SQL in a database, right?

Aug 1 '06 #2

P: n/a
There's an example of what pietlinden is suggesting here:
Duplicate the record in form and subform
at:
http://allenbrowne.com/ser-57.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<pi********@hotmail.comwrote in message
news:11*********************@b28g2000cwb.googlegro ups.com...
Oh, do it the easy way. Add a primary key (autonumber) to your
subform's recordsource. if you grab the primary key of the old record,
you can then insert it after adding the new record. you'd just get
both PK's and then insert into the subform table using a paramterized
SQL statement.

Aug 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.