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