Results 1 to 8 of 8
  1. #1
    pillaisg is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2023
    Posts
    2

    Duplicate selected records with a field with same value.

    Selected records appearing in a subform shall be duplicated. While duplicating the records one field shall take the value from a textbox from the form.
    Eg.
    I am having a form with comboboxes where I can select shopname and the fruits supplied to that particular shop which are listed in the subform. The records in the subform shall be duplicated (sometimes selected records / all records) by keeping the new shopname based on a text box which I have assigned in the form.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Exactly what is your question? Have you tried anything? What happens? What do you mean by 'duplicate'? What data should duplicate?

    You could provide db for analysis. Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    The subform records will already been linked from the shopID in the mainform, so you have everything you need in the subform.?

    You could use the recordsetclone of the subform and walk that and insert new records with sql for any that have whatever way you are using for marking the ones that need to be duplicated?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    I'm with June7, what's the question or issue you are having? What is your table(s) structure? So is it like:

    Shop1 (main form key field) below fruits all on the subform?
    Banana 10
    Apple 2
    Banana 3
    Orange 4

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    It reads like a class assignment given that there's no real question.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    madpiet is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Feb 2023
    Posts
    154
    Why not just grab the foreign key, use that to get the records you want, and then create the append query using that? the whole idea of using RecordsetClone (well, unless you're filtering by form or something) is just making a really simple question more complicated.

  8. #8
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Quote Originally Posted by madpiet View Post
    Why not just grab the foreign key, use that to get the records you want, and then create the append query using that? the whole idea of using RecordsetClone (well, unless you're filtering by form or something) is just making a really simple question more complicated.
    Well I was expecting that there would be some flag to indicate whether that record should be deuplicated or not?
    That control would likely be unbound?, as no need to save it, so how would one do it via a query?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 04-01-2020, 09:21 AM
  2. Replies: 9
    Last Post: 08-07-2017, 12:28 AM
  3. Replies: 3
    Last Post: 04-21-2017, 01:41 PM
  4. Replies: 3
    Last Post: 10-07-2016, 03:28 AM
  5. Replies: 14
    Last Post: 12-06-2012, 11:25 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums