2

したがって、ボタンをクリックすると、正しいファイル名で保存ダイアログが開き、プレビューモードでレポートが開きますが、[保存]をクリックするとエラーコードが表示されます。オブジェクトが宣言されていないからだと他の人が言うのを見たことがあります。誰か助けてもらえますか?これを機能させると、毎月6時間以上ファイル名を手動で入力する手間が省けます。

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
4

1 に答える 1

0

コメントから:

私は自分の間違いを理解しました:これがDoCmd.Outputto行の修正です:

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

–ニック

于 2012-09-14T11:26:51.767 に答える