Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Niagara Falls, New York, USA
    Thanked 0 Times in 0 Posts

    Duplicate Record Questions (A2k (9.0.4402) SR-1)

    Duplicate Record Questions

    A2k (9.0.4402) SR-1

    I have a Duplicate Record button on a form that was built with the wizard and generated the following code:

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

    1. How do I translate the above three statements? What do the commands mean?

    2. I thought RunCommand replaced DoMenuItem, why does DoMenuItem get generated?

    3. How do I find out the events a duplicated record goes through?

    4. How do I get rid of the following message when I Duplicate record then exit form,

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Crystal Beach, FL, Florida, USA
    Thanked 40 Times in 39 Posts

    Re: Duplicate Record Questions (A2k (9.0.4402) SR-1)

    You can "translate" the DoCmd.DoMenuItem commands by opening your form in form view, then looking at the Edit command on the MenuBar. The commands in code relate to the various commands in the Edit dropdown menu.

    For some obscure reason, Microsoft never updated the wizards to use RunCommand! Offhand, I don't know what the RunCommand constants are to duplicate a record, but you should be able to figure it out yourself. for example, the first DoMenuItem might correspond to Select a Record, so you would use "Runcommand accmdSelectRecord".
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Duplicate Record Questions (A2k (9.0.4402) SR-1)

    I'm with Mark. I don't understand why the wizards still write Access 95 code, especially when DoMenuItem has been marked as obsolete in the help files for the last 3 versions. Futhermore, the newer code is much easier to read and understand. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

    Anyhow, here are the equivalent lines in Access 97-forward code:

    'select the current record
    DoCmd.RunCommand acCmdSelectRecord

    'copy the current record
    DoCmd.RunCommand acCmdCopy

    'append the copy to the recordset
    DoCmd.RunCommand acCmdPasteAppend

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts