Pregunta

Estoy intentando guardar un archivo rtf usando FileDialog y me gustaría filtrar usando una cláusula where. Esto es lo que tengo:

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

¿Alguna idea sobre cómo podría agregar la cláusula where sin cambiar el informe?

¿Fue útil?

Solución

Descubrí que la forma más sencilla de hacer esto sin tocar el código del informe en sí es abrir el informe en modo de vista previa con el filtro aplicado y luego enviar el informe al formato que sea necesario.

If .Show Then
    DoCmd.OpenReport Me.cmbPickAReportToPrint.Value, acViewPreview, , "fieldToFilterOn = 'value'"
    DoCmd.OutputTo acOutputReport, Me.cmbPickAReportToPrint.Value, acFormatRTF, .SelectedItems(1)
End If
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top