Public Function funCopyPasteRec()
On Error GoTo Err:
If Not IsLoaded("主窗体") Then Exit Function
If MsgBox("复制记录吗?", vbYesNo + 32, "提示信息") = vbYes Then
Forms("主窗体").子窗体.SetFocus
DoCmd.RunCommand acCmdCopy
DoCmd.SetWarnings False '关闭警告
DoCmd.RunCommand acCmdPasteAppend
DoCmd.SetWarnings True '打开警告
End If
Err: Exit Function
End Function
Public Function funDeleteRec()
On Error GoTo Err:
If Not IsLoaded("主窗体") Then Exit Function
If MsgBox("记录删除后不能恢复,你确定删除选中的数据吗?", vbYesNo + 32, "提示信息") = vbYes Then
Forms("主窗体").子窗体.SetFocus
DoCmd.SetWarnings False '关闭警告
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True '打开警告
End If
Err: Exit Function
End Function
示例下载: 点击这里下载