2012-04-27 5 views
2

버튼을 클릭하면 올바른 파일 이름으로 저장 대화 상자가 열리고 미리보기 모드로 보고서가 열립니다. 저장을 클릭하면 오류 코드가 표시됩니다. 나는 다른 사람들이 그 물건이 선언되지 않았기 때문이라고 말한 것을 보았다. 누구든지 나를 도울 수 있습니까? 이 기능을 사용하면 매월 수동으로 파일 이름을 입력하는 데 6 시간 이상을 절약 할 수 있습니다. 댓글에서Access 2010의 VBA 코드에서 오류가 발생했습니다. "데이터베이스"가 '| 1'개체를 찾을 수 없습니다.

Option Compare Database 

'------------------------------------------------------------ 
' Export_MLR 
' 
'------------------------------------------------------------ 
Function Export_MLR() 
On Error GoTo Export_MLR_Err 
    Dim strReportName As String 
    DoCmd.OpenReport "Market Rate Notification Final", acViewPreview 
    strReportName = Format(Reports![Market Rate Notification Final].Market_ID, "00") & " " & Reports![Market Rate Notification Final].Product_Code & "-" & "Market Rate Notification Final" & "_" & Format(Date, "mmddyy") 
    DoCmd.OutputTo acOutputReport, strReportName, "PDFFormat(*.pdf)", "", False, "", , acExportQualityScreen 


Export_MLR_Exit: 
    Exit Function 

Export_MLR_Err: 
    MsgBox Error$ 
    Resume Export_MLR_Exit 

End Function 
+0

I을 내 자신의 실수를 알아 냈어 : DoCmd.Outputto 행 수정 : DoCmd.OutputTo acOutputReport, "Market Ra "PDFFormat (* .pdf)", strReportName, False,,, acExportQualityScreen 이제 유일한 문제는 코드를 변경하여 매번 다른 대상 폴더를 선택할 수 있습니까? – Nick

답변

0

:

난 내 자신의 실수를 알아 낸

: 여기 DoCmd.Outputto 라인에 수정 프로그램입니다 :

DoCmd.OutputTo acOutputReport, "Market Rate Notification Final", 
"PDFFormat(*.pdf)", strReportName, False, , , acExportQualityScreen 

이 - 닉