473,770 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

duplicate record command button

6 New Member
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 2380
nico5038
3,080 Recognized Expert Specialist
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
nomvula
6 New Member
thanks Nico, i'll have a look at that
Aug 13 '08 #3
nico5038
3,080 Recognized Expert Specialist
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
14587
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
8
20552
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 similar to the existing record with minor differences. It will save the data input operator a lot of afford by editing the minor difference only. However, the new record is not allowed to be saved if the operator forgets to make the modification for...
3
28843
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 make one or two changes to the new one. This is the problem I have with Access. Look at this answer! >Private Sub btnCopy_Click() >On Error GoTo handle_error > Set cnxn = CurrentProject.Connection > Set rs = New ADODB.Recordset
2
3233
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 primary key. My first attempt seemed to work(minus a few Microsoft glitches). I used a "duplicate" command button at first. This made a copy of the record but failed to bump up the primary key by 1 number(so it seemed). Actually, the number did...
1
9048
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 acCmdSaveRecord DoCmd.RunCommand acCmdCopy DoCmd.RunCommand acCmdPasteAppend OR DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
9
4150
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 clicked. CustomerID, StatusType are values that are manually entered by the user; StatusDate is automatically filled with the current date that the record is saved. I would like to use code behind the cmdSave button to check the table for...
3
1457
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 been clicked. Can anyone help me create this event or any event that will notify the user that the duplicate record button has been clicked?
1
2301
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 once the duplicate record is clicked so that the user will know that it has been clicked. Can anyone help me create this event or any event that will notify the user that the duplicate record button has been clicked?
2
4016
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 18-Apr-08 01-Mar-08 Fees: Asset 1 R 31,200.00 R 31,200.00 NMBM 22-Apr-08 23-Mar-08 P-MI (E) 07/2006 3 R 47,485 R 38,849 i have 200 records deplayed in the form i'm using access2007 and i have a command button which is the built in command button to...
0
9602
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, 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...
0
10071
jinu1996
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...
1
10017
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8905
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7431
isladogs
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...
0
6690
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();...
0
5326
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...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.