Duplicate Record Button Overwrites Existing Record

ToddNYC

Registered User.
Local time
Today, 03:56
Joined
Sep 24, 2012
Messages
23
Hi -- My "duplicate record" button on my form has started to act very strange, and I'm not sure what I did wrong! I created it using the wizard, and it worked for a long time, but now when I use it the following happens: (1) An empty record is created with a new ID, and (2) it overwrites record 4 in my main table.

If I repeat pushing the button, additional black records are created, and record 4 (only that record) is overwritten with the file again.

I tried to delete the button and create a new one, but same problem exists. Any ideas as to what I might have done to mess this up?

Thanks for your help!
 
Last edited:
First off, did you use code or a macro to do this? Second, if VBA, what is the code you used? If Macro what are the actions and arguments that you are using?
 
Thanks Bob for the reply. The button was created by using the controls wizard, and I believe it is a macro. Button action is On Click [Embedded Macro]. I don't know how to copy contents of a macro, but here is the code:

On Error
go to next
macro name
RunMenuCommand
command Select Record

If [macroerror]=0 then
RunMenuCommand
command copy
end if

If [macroerror]=0 then
RunMenuCommand
command RecordsGoToNew
end if

If [macroerror]=0 then
RunMenuCommand
command SelectRecord
end if

If [macroerror]=0 then
RunMenuCommand
command Paste
end if

If [macroerror]<>0 then
messagebox
message = [macroerror].[description]
beep yes
type none
title
end if

Also, Bob, not sure if it is relevant, but the form that contains this button is on a tabbed navigation layout with two other forms on the two other tabs.
 

Users who are viewing this thread

Back
Top Bottom