473,385 Members | 2,014 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,385 software developers and data experts.

duplicate record command button

hi guys
i need help, i have a form which is diplayed in a Datasheet view with more that 2 hundred records, when a user needs to add new entries i want him/her to select atleast 5 or more rows and click duplicate record button to duplicate those five records but at the moment only 1 record is getting duplicated
Aug 12 '08 #1
3 2366
nico5038
3,080 Expert 2GB
Hi nomvula,

Best to check the code of this sample:
http://www.geocities.com/nico5038/xS...p-Down2000.zip
It shows how to select the rows from a datasheet subform and will allow you to write the needed INSERT loop.

Nic;o)
Aug 12 '08 #2
thanks Nico, i'll have a look at that
Aug 13 '08 #3
nico5038
3,080 Expert 2GB
In the subform the code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2. Parent.txtSelLength = Me.SelHeight
  3. Parent.txtSelstart = Me.SelTop
  4.  
  5. Dim rs As Recordset
  6. Dim intI As Integer
  7.  
  8. Set rs = Me.RecordsetClone
  9.  
  10. rs.MoveFirst
  11. intI = 1
  12. While intI < Me.SelTop
  13.  intI = intI + 1
  14.  rs.MoveNext
  15. Wend
  16. 'now positioned on the first
  17.  
  18. 'Init resultfield
  19. Parent.txtSelected = ""
  20.  
  21. intI = 0
  22.  
  23. While intI < Me.SelHeight
  24.  Parent.txtSelected = Parent.txtSelected & " " & rs!Field1
  25.  intI = intI + 1
  26.  rs.MoveNext
  27. Wend
  28.  
  29. Set rs = Nothing
  30.  
  31. End Sub
  32.  
Is filling the fields of the mainform with the rows and more important the keys (here field1). The same loop can be used to execute an insert statement for duplicating the selected rows.

What more do you need o know ?

Nic;o)
Aug 25 '08 #4

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

Similar topics

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...
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: stranger | last post by:
My database is set up so people can input parts orders. Sometimes they order the same parts on a monthly basis. I want to be able to duplicate past parts orders and have it pasted in with a new...
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...
9
by: rjshrader | last post by:
I have a table (tblStatus) with three fields (CustomerID, StatusType and StatusDate). I use an unbound form with three text boxes to enter data into the table when a command button (cmdSave) is...
3
by: mlb992000 | last post by:
I have a form that has a duplicate record command button and I need to create an event that will clear two of the fields once the duplicate record is clicked so that the user will know that it has...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
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...

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.