473,320 Members | 1,936 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,320 software developers and data experts.

Error when duplicating records

I have used the wizard to create a Duplicate Record command button on a
form. It works fine for a single duplicate but if I want to duplicate
an additional record I receive an error:

"The command or action 'Paste Append' is not available right now."

I have to close out of the form and reopen to get the button to work
again. A bit of a nuisance.

Any suggestions.

Below is the code the wizard has written - much thx for any
suggestions...

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

Exit_Duplicate_Click:
Exit Sub

Err_Duplicate_Click:
MsgBox Err.Description
Resume Exit_Duplicate_Click

End Sub

Jan 11 '07 #1
1 2027
samdev wrote:
>I have used the wizard to create a Duplicate Record command button on a
form. It works fine for a single duplicate but if I want to duplicate
an additional record I receive an error:

"The command or action 'Paste Append' is not available right now."

I have to close out of the form and reopen to get the button to work
again. A bit of a nuisance.

Any suggestions.

Below is the code the wizard has written - much thx for any
suggestions...

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

Are you sure the record was saved before trying to add
another? If you're not sure, add:
If Me.Dirty Then Me.Dirty = False
to the top of the procedure.

Note that using that wizard generated code tries to copy
every **visible** control, even ones you should not copy
(e.g. the primary key). That also means that it does not
copy any invisible values.

For much more control over the dup operation, use this kind
of logic:

With Me.RecordsetClone
.AddNew
!thisfield = Me.thisfield
!thatfield = Me.thatfield
!otherfield = Me.otherfield
!datecreatedfield = Now
' skip autonumber field or use
' !pkfield = somevalue
.Update
Me.Bookmark = .LastModified
End With

--
Marsh
Jan 11 '07 #2

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

Similar topics

0
by: Karam Chand | last post by:
Greetings I manage a website wherein i keep track of the people email who have downloaded my software and the version number. the structure is like - id int auto_increment primary key,...
1
by: pwys | last post by:
Hello to everyone WOndering if there anyone could help me with this. I have a Primary & a secondary table with the unique key (InvoiceNo) Waht i want is to make duplicate copy of a selected...
7
by: Paolo | last post by:
I know I should not be doing this, but I find it very useful. I have a database in Access which stores data for a small company. Sometimes we need to add similar information to different tables....
3
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records...
2
by: kkiger | last post by:
My problem is this, I can set up a command button to duplicate a record everytime I click on it. What happens is that I get a record but it will be at the end of the table. For example, if I am on...
2
by: jthep | last post by:
I'm trying to get this piece of code I converted from C to work in C++ but I'm getting an access violation error. Problem occurs at line 61. Someone can help me with this? The function...
7
by: EManning | last post by:
Using A2003. I'm receiving this error when returning from a "DoCmd.OpenReport..." statement. I have a tab control with a subform on every tab. The user selects an item from a combobox at the top...
2
by: zandiT | last post by:
hello i created a database that has a form which represents a template. this template is filled out every month. my problem is i don't want to have to copy and paste ever record wen the template is...
5
mseo
by: mseo | last post by:
hi, I have developed a form for add new category using Ms-Access 2003 the first problem for me I got the error 3022 for no duplicating values and i have solved this one using this code: Private...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.