wizard buttons code

Qamar

Registered User.
Local time
Today, 14:38
Joined
Jun 28, 2004
Messages
42
Hello,

I have often read on these forums that the code which normally creates command button wizards are often obsolete and rather than using the domenuitem, it is recommended to use the docmd.runcommand alternative.

Now i am about to create a button which duplicates a records, and the code used by the wizard is :

Code:
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
    DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

Could someone tell me please if DoCmd.RunCommand acCmdDuplicate is it's equivalent, and if not which code can be used to substitute that?

TU
 
I'm guessing, based on the context, that the direct substitutions would be:

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPaste
 
thx for your reply, i will give that a try.
 
I think you need to move to a new record before pasting:

Code:
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
[B]DoCmd.GoToRecord , , acNewRec[/B]
DoCmd.RunCommand acCmdPaste
 

Users who are viewing this thread

Back
Top Bottom