Domanda

Sto tentando di salvare un file rtf usando FileDialog e vorrei filtrare usando una clausola where. Questo è quello che ho:

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

Qualche idea su come potrei aggiungere la clausola where senza modificare altrimenti il ??rapporto?

È stato utile?

Soluzione

Ho scoperto che il modo più semplice per farlo senza toccare il codice del report stesso è quello di aprire il report in modalità di anteprima con il filtro applicato e quindi generare il report in qualunque formato sia necessario.

If .Show Then
    DoCmd.OpenReport Me.cmbPickAReportToPrint.Value, acViewPreview, , "fieldToFilterOn = 'value'"
    DoCmd.OutputTo acOutputReport, Me.cmbPickAReportToPrint.Value, acFormatRTF, .SelectedItems(1)
End If
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top