Office中国论坛/Access中国论坛

标题: 导出到报表快照后出错 [打印本页]

作者: yrlxm    时间: 2004-11-26 15:53
标题: 导出到报表快照后出错
导出到报表快照后出错



我用以下代码可以正常导出快照,但每次导出结束都提示access遇到问题要关闭.

如果直接打开报表,在菜单中选择导出则正常.

请问怎么回事? 我如何用代码调用  菜单命令?因为我要 自定义文件名 .



Sub OutPutToSnapShot(sDate As Date)

   

  On Error GoTo Err_OutPutToSnapShot



   

    Dim stDocName As String

    Dim Path As String

    Dim fileName As String



    Path = "d:\table\Snapshot\"

   

    fileName = Path & Format(sDate, "yyMMdd") & "report34.snp"

    stDocName = "è?±¨±í1"

    DoCmd.OutputTo acReport, stDocName, "SnapshotFormat(*.snp)", fileName

   

    fileName = Path & Format(sDate, "yyMMdd") & "report2.snp"

    stDocName = "è?±¨±í2"

    DoCmd.OutputTo acReport, stDocName, "SnapshotFormat(*.snp)", fileName

  

Exit_OutPutToSnapShot:

  Exit Sub

Err_OutPutToSnapShot:

  MsgBox Err.Description

  Resume Exit_OutPutToSnapShot

  

End Sub




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3