473,379 Members | 1,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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 2408
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jon Cooper | last post by:
I have looked long n hard at the Insert Select as being the answer to my need to create duplicate records. (Purpose is basically to allow someone to create a duplicate of an existing email template...
9
by: Catherine Jo Morgan | last post by:
Can I set it up so that a certain combination of fields can't contain the same entries, on another record? e.g. a combination of FirstName/LastName/address? Or FirstName/LastName/phone? Or...
1
by: pwys | last post by:
Hello to everyone WOndering if there anyone could help me with this. I have a Primary & a secondary table with the unique key (InvoiceNo) Waht i want is to make duplicate copy of a selected...
6
by: Robin S. | last post by:
**Eric and Salad - thank you both for the polite kick in the butt. I hope I've done a better job of explaining myself below. I am trying to produce a form to add products to a table (new...
8
by: Josetta | last post by:
I have found a wealth of information here on how to duplicate records in forms with subforms. I have adapted code found here to work with my forms. It works beautifully the first time I hit the...
1
by: samdev | last post by:
I have used the wizard to create a Duplicate Record command button on a form. It works fine for a single duplicate but if I want to duplicate an additional record I receive an error: "The...
3
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we...
7
by: Albennett | last post by:
Hello. I’m new to writing VBA code but getting there thanks, for the most part, to the excellent advice on this site. I trying to create the code which will allow all records from a subform to...
1
by: xraive | last post by:
I have a problem with this. Currently I am trying Allen's code and i am not successful. Current Design Table1 (Main Form) TravelID (PK) ApprovedBY EntreredBy BudgetCode ExpenseCode
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.