Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ms access 如何在MS Access中通过FileDialog保存时筛选报表对象_Ms Access_Vba_Report_Filedialog - Fatal编程技术网

Ms access 如何在MS Access中通过FileDialog保存时筛选报表对象

Ms access 如何在MS Access中通过FileDialog保存时筛选报表对象,ms-access,vba,report,filedialog,Ms Access,Vba,Report,Filedialog,我试图使用FileDialog保存rtf文件,并希望使用where子句进行筛选。这就是我所拥有的: Set dlgSave = FileDialog(msoFileDialogSaveAs) With dlgSave .Title = "Provide the place to save this file" .ButtonName = "Save As..." .InitialFileName = Me.cmbPickAReportToPrint.Value & "-" &

我试图使用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