MS AccessでFileDialogを使用して保存するときにレポートオブジェクトをフィルター処理する方法

StackOverflow https://stackoverflow.com/questions/154064

質問

FileDialogを使用してrtfファイルを保存しようとしていますが、where句を使用してフィルタリングしたいと思います。これは私が持っているものです:

Set dlgSave = FileDialog(msoFileDialogSaveAs)
With dlgSave
  .Title = "Provide the place to save this file"
  .ButtonName = "Save As..."
  .InitialFileName = Me.cmbPickAReportToPrint.Value & "-" & Format(Date, "mmddyy") & ".rtf"
  .InitialView = msoFileDialogViewDetails

  If .Show Then
      DoCmd.OutputTo acOutputReport, Me.cmbPickAReportToPrint.Value, acFormatRTF, .SelectedItems(1)
  End If
End With

レポートを変更せずにwhere句を追加する方法に関するアイデアはありますか?

役に立ちましたか?

解決

レポートコード自体に触れることなくこれを行う最も簡単な方法は、フィルターを適用してプレビューモードでレポートを開き、必要な形式でレポートを出力することです。

If .Show Then
    DoCmd.OpenReport Me.cmbPickAReportToPrint.Value, acViewPreview, , "fieldToFilterOn = 'value'"
    DoCmd.OutputTo acOutputReport, Me.cmbPickAReportToPrint.Value, acFormatRTF, .SelectedItems(1)
End If
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top