473,395 Members | 1,488 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,395 software developers and data experts.

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
Feb 4 '10 #1
3 1905
missinglinq
3,532 Expert 2GB
Place an unbound textbox, call it NumberCopies.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdMultiCopy_Click()
  2.  
  3. Dim Copies as Integer
  4.  
  5. If Not IsNull(Me.NumberCopies) then
  6.  
  7. Copies = Me.NumberCopies
  8.  
  9.  
  10. For I = 1 To Copies
  11.   If Me.Dirty Then Me.Dirty = False
  12.   DoCmd.RunCommand acCmdSelectRecord
  13.   DoCmd.RunCommand acCmdCopy
  14.   DoCmd.GoToRecord , , acNewRec
  15.   DoCmd.RunCommand acCmdPaste
  16.  Next I
  17.  
  18. End If
  19. 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)>
Feb 4 '10 #2
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.
Feb 18 '10 #3
gershwyn
122 100+
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.
Feb 18 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

44
by: Xah Lee | last post by:
here's a large exercise that uses what we built before. suppose you have tens of thousands of files in various directories. Some of these files are identical, but you don't know which ones are...
8
by: Ray | last post by:
I have a data input form and need to automatically duplicate the existing record as a new record by clicking a button. The main purpose to duplicate the record is that the new record is very...
3
by: Nhmiller | last post by:
I searched here for an answer. I am entering records into a database, and it would save a lot of time if I could duplicate a record that is very similar to the new one I am about to enter, then...
2
by: news | last post by:
I just upgraded to PHP 4.4.2 on my Slackware 10.2 system. And Apache/mySQL/PHP all work great through a browser. No errors. But when I try to run a PHP script through the command line, which I...
1
by: 2D Rick | last post by:
Access2003 in XP If I open a form to a specific record and click on a command button with the following code I get a duplcate record: DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand...
4
by: FangQ | last post by:
hi I am very new to mysql. I have a question about using the "on duplicate update" clause with insert command. my table "data" has two columns, field1 and field2, where field1 is the index...
4
theaybaras
by: theaybaras | last post by:
Hi All, I am creating a databse of articles and related information. I need to find a way to prevent the user from inputting duplicate information in a few forms. In one of these forms I can...
1
by: mlb992000 | last post by:
I have a form that has a duplicate record command button that allows the user to duplicate all information on the form and change two fields. I need to create an event that will clear the two fields...
2
by: nomvula | last post by:
hi guys i need some help to duplicate records on my form datasheet: here's the example of my form results: ClientLookup DateCaptured ForecastDate Description ForecastQuantity Forecast Actual UJ...
4
by: AXESMI59 | last post by:
have a project in which I am entering Serial Numbers and Date codes into a Combo box. Serial numbers are all different. However, they could each have the same Date Code. Each Serial Number has a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
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...

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.