Connecting Tech Pros Worldwide Forums | Help | Site Map

Duplicating Records with Subform containing duplicate values...

mavmavv@gmail.com
Guest
 
Posts: n/a
#1: Aug 1 '06
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?


pietlinden@hotmail.com
Guest
 
Posts: n/a
#2: Aug 1 '06

re: Duplicating Records with Subform containing duplicate values...


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?

Allen Browne
Guest
 
Posts: n/a
#3: Aug 2 '06

re: Duplicating Records with Subform containing duplicate values...


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.

<pietlinden@hotmail.comwrote in message
news:1154469575.790585.53020@b28g2000cwb.googlegro ups.com...
Quote:
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.

Closed Thread