Connecting Tech Pros Worldwide Forums | Help | Site Map

Is There a Simple way to duplicate a record?

Nhmiller
Guest
 
Posts: n/a
#1: Nov 13 '05
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!
[color=blue]
>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[/color]

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:
[color=blue]
>For instance, duplicating a record is a handy button to have, but there is[/color]
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

Wayne Morgan
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Is There a Simple way to duplicate a record?


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" <nhmiller@aol.comnojunk> wrote in message
news:20050107153941.06537.00002646@mb-m15.aol.com...[color=blue]
>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!
>[color=green]
>>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[/color]
>
> 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:
>[color=green]
>>For instance, duplicating a record is a handy button to have, but there is[/color]
> 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[/color]


Nhmiller
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Is There a Simple way to duplicate a record?


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
Wayne Morgan
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Is There a Simple way to duplicate a record?


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" <nhmiller@aol.comnojunk> wrote in message
news:20050108005410.06270.00001664@mb-m23.aol.com...[color=blue]
> 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[/color]


Closed Thread