473,725 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Duplicating Records with Subform containing duplicate values...

I have a Form where I have created a duplicate record button, no

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.DoMenuIte m acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuIte m acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuIte m acFormBar, acEditMenu, 5, , acMenuVer70 'Paste

Any ideas?

Aug 1 '06 #1
2 2434
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

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********@hot mail.comwrote in message
news:11******** *************@b 28g2000cwb.goog legroups.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

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 then modify it). I have tried all sorts of variations on: INSERT INTO emaillist SELECT * FROM emaillist WHERE emailid = #url.emailid# (inc trying IGNORE) but of course this throws an error over duplicate keys. All I want to do is to take...
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 FirstName/LastName/email? Or is it possible to allow this but to throw up an alert message? Warning that this person is probably already in the database? TIA
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 invoice no (both Primary & secondary) into a new invoice no. can some one help me in this?
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 products). Tables: tblCategoryDetails CategoryID SpecID
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 "duplicate" button. It copies the main form data, the subform data and moves to the new record. Great! Here's the problem...if I move to another record (or stay on the newly created record, for that matter), and hit the Duplicate button...
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 command or action 'Paste Append' is not available right now." I have to close out of the form and reopen to get the button to work again. A bit of a nuisance. Any suggestions.
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 incur numerous service problems “Events”. Each morning we have a global conference call where events which occurred within the previous 24 hours are discussed. Prior to the call, an analyst has to review these events and provide a report, ‘The Morning...
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 be copied and duplicated back in the original underlying table for that subform. To give a bit more background, the main form contains records of individual ‘reports’ (held in table called CPG1) and the subform (CPG3_Subform) identifies the...
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
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.