2008-09-30 3 views
3

FileDialog를 사용하여 rtf 파일을 저장하려고하고 where 절을 사용하여 필터링하려고합니다. 내가 그렇지 않으면 보고서를 변경하지 않고 where 절을 추가 할 수있는 방법에 대한MS Access에서 FileDialog를 통해 저장할 때 보고서 개체를 필터링하는 방법

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 

어떤 아이디어 : 이것은 내가 가진 무엇인가?

답변

3

보고서 코드 자체를 건드리지 않고이 작업을 수행하는 가장 쉬운 방법은 필터를 적용한 미리보기 모드에서 보고서를 열고 필요한 형식으로 보고서를 출력하는 것입니다.

If .Show Then 
    DoCmd.OpenReport Me.cmbPickAReportToPrint.Value, acViewPreview, , "fieldToFilterOn = 'value'" 
    DoCmd.OutputTo acOutputReport, Me.cmbPickAReportToPrint.Value, acFormatRTF, .SelectedItems(1) 
End If 
관련 문제