[AccessD] duplicating a row

Arthur Fuller fuller.artful at gmail.com
Sat Jun 20 08:28:47 CDT 2009


Here's a function that I use for this purpose:
<vba>
Public Function aaDuplicate(frm As Form)
On Error GoTo Err_aaDuplicate

    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdCopy
    DoCmd.RunCommand acCmdPasteAppend
    MsgBox "Change the name, date etc.", vbInformation, "Duplicate Record"

Exit_aaDuplicate:
    Exit Function

Err_aaDuplicate:
    MsgBox Err.Description
    Resume Exit_aaDuplicate

End Function
</vba>

Note that the function expects the form to be passed in as a form, not a
string. You can achieve this by passing Me in.

HTH,
Arthur



More information about the AccessD mailing list