我正在尝试使用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