By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,990 Members | 1,710 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,990 IT Pros & Developers. It's quick & easy.

Is There a Simple way to duplicate a record?

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.