473,395 Members | 1,568 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.

Is There a Simple way to duplicate a record?

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
If IsNull(Me.lstRecords.Value) Then
MsgBox "No item selected", , "Selection Needed"
Else
etc.etc.etc.

When I used Lotus Approach, there was an icon and a dropdown command to
duplicate the record presently being displayed. That was it!

I saved a reply from a while back to the same question I posed:
For instance, duplicating a record is a handy button to have, but there is

none

Here's the reply I got:

"There is one...just click the Command Button icon on the Toolbox and pick
the Records Category and choose Duplicate Record from the right side."

But, how do I get the Tool Box to appear? When I have a record open in Forms, I
see no icon for Toolbox, I see it in no dropdown menu, and when I enter
"toolbox" in Help, there is nothing about how to access it. When I finally got
the toolbox to appear, from some options menu (I think), it was completely
grayed when I had a record open in Forms.

Neil
Cat Paintings At Carol Wilson Gallery
http://www.carolwilsongallery.com
Nov 13 '05 #1
3 28819
The toolbox referred to is available in Form Design View. The person is
talking about adding a command button to the form. The command button wizard
has as one of its options to make a command button that will duplicate a
record.

The code this wizard creates for the button is:

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

The entries on the menu bar associated with these commands are under the
Edit menu.
1) Select Record
2) Copy
3) Paste Append

Another option is to use the BeforeUpdate event of the form to set the
Default Value of desired controls to their current value. This will cause
those controls to "carry over" their current values as the default in the
next new record. This will work after you have made a change (including
entering a new record) to a record. Just browsing the records won't affect
this.

--
Wayne Morgan
MS Access MVP
"Nhmiller" <nh******@aol.comnojunk> wrote in message
news:20***************************@mb-m15.aol.com...
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
If IsNull(Me.lstRecords.Value) Then
MsgBox "No item selected", , "Selection Needed"
Else


etc.etc.etc.

When I used Lotus Approach, there was an icon and a dropdown command to
duplicate the record presently being displayed. That was it!

I saved a reply from a while back to the same question I posed:
For instance, duplicating a record is a handy button to have, but there is

none

Here's the reply I got:

"There is one...just click the Command Button icon on the Toolbox and pick
the Records Category and choose Duplicate Record from the right side."

But, how do I get the Tool Box to appear? When I have a record open in
Forms, I
see no icon for Toolbox, I see it in no dropdown menu, and when I enter
"toolbox" in Help, there is nothing about how to access it. When I finally
got
the toolbox to appear, from some options menu (I think), it was completely
grayed when I had a record open in Forms.

Neil
Cat Paintings At Carol Wilson Gallery
http://www.carolwilsongallery.com

Nov 13 '05 #2
Thanks for your complete explanation. I posted a reply to my own post when I
discovered the items I needed were in the Edit menu, as you pointed out.
Regarding that my reply did not show up -- this newsgroup and the windows xp
general newsgroup both have failed to post some of my messages in the last few
days. It could be AOL's doing -- I use their newsgroup feature, which has
always been very reliable and easy to use. Curious to know if you have any help
here. I even posted a message at windows xp general regarding messages not
appearing, and that message itself did not show up.

Neil
Cat Paintings At Carol Wilson Gallery
http://www.carolwilsongallery.com
Nov 13 '05 #3
I don't know what would cause the messages to not show up. I stay as far
away from AOL as I can, so I can't help you much with that.

--
Wayne Morgan
MS Access MVP
"Nhmiller" <nh******@aol.comnojunk> wrote in message
news:20***************************@mb-m23.aol.com...
Thanks for your complete explanation. I posted a reply to my own post when
I
discovered the items I needed were in the Edit menu, as you pointed out.
Regarding that my reply did not show up -- this newsgroup and the windows
xp
general newsgroup both have failed to post some of my messages in the last
few
days. It could be AOL's doing -- I use their newsgroup feature, which has
always been very reliable and easy to use. Curious to know if you have any
help
here. I even posted a message at windows xp general regarding messages not
appearing, and that message itself did not show up.

Neil
Cat Paintings At Carol Wilson Gallery
http://www.carolwilsongallery.com

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Giloosh | last post by:
Hello, i need some help if possible... i have a payments table with over 500 records i want to run a query that searches through the table spotting out any duplicate ID#'s and Dates. So basically...
1
by: Robert | last post by:
How can I query an existing table and update a field in each record in the table with the occurrence count of each record e.g. update field to 1 (= first record occurrence), update field to 2 for...
8
by: Mark | last post by:
When my form goes to a new record, I have a procedure that copies the last record added to the form's underlying table into the form. The intent is that a series of new records may have the same...
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...
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...
0
by: claus | last post by:
Hi, I am not a programmer but tries anyway to program a feature in a form where I am able to copy entries for the form and a subform. I have tried follow the guide here...
2
by: Ranma13 | last post by:
Hello, I have a duplicate record check written in VB for a check in/check out database. Here's the pseudocode, written for the BeforeUpdate property on the form: If DCount(search for records with...
1
by: xraive | last post by:
I have a problem with this. Currently I am trying Allen's code and i am not successful. Current Design Table1 (Main Form) TravelID (PK) ApprovedBY EntreredBy BudgetCode ExpenseCode
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:
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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,...

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.