468,765 Members | 1,726 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Duplicating Records with Subform containing duplicate values...

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
2 2190
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
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.

Similar topics

4 posts views Thread by Jon Cooper | last post: by
9 posts views Thread by Catherine Jo Morgan | last post: by
1 post views Thread by pwys | last post: by
8 posts views Thread by Josetta | last post: by
1 post views Thread by samdev | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.