Duplicate Command on Forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pinkdanbob
    New Member
    • Feb 2010
    • 3

    Duplicate Command on Forms

    I have a form which enters records onto a table. I want to create a button which duplicates the record more than once therefore the duplicate command button is no good as I may need the record duplicated 10-100 times. Is there any way I can create a button which will enable me to enter how many duplicates of the record I want?

    Thanks
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Place an unbound textbox, call it NumberCopies.

    Code:
    Private Sub cmdMultiCopy_Click()
    
    Dim Copies as Integer
    
    If Not IsNull(Me.NumberCopies) then
      
    Copies = Me.NumberCopies
    
    
    For I = 1 To Copies
      If Me.Dirty Then Me.Dirty = False
      DoCmd.RunCommand acCmdSelectRecord
      DoCmd.RunCommand acCmdCopy
      DoCmd.GoToRecord , , acNewRec
      DoCmd.RunCommand acCmdPaste
     Next I
    
    End If
    End Sub
    But the question is, why? Are you going to change one or more fields on each record? You don't really want multiple totally identical records.

    Welcome to Bytes!

    Linq ;0)>

    Comment

    • pinkdanbob
      New Member
      • Feb 2010
      • 3

      #3
      I want to duplicate identical records as I am creating a stock form- I want to record what each pallet of stock contains and some pallets contain 50 of the exact same item and I need them to appear 50 times so I can link a customer to each product...

      I'm not very tech so were do I put all the writing you gave me? I only know the really know the real basics of access!

      Thanks for your help.

      Comment

      • gershwyn
        New Member
        • Feb 2010
        • 122

        #4
        I would suggest that you add a field to your table to track quantity rather than duplicate the same record so many times. You haven't given many details about your project, but I can't imagine a situation where you wouldn't want to just assign a number for quantity. It will make adding items, removing items, counting the number of items, etc. much simpler.

        Comment

        Working...