Report Preview and RTF discrepancy

  • Thread starter Thread starter DubboPete
  • Start date Start date
D

DubboPete

Hi all,
The filtered report I am working on comes up with the goods when I
preview it, but when I try and output the file to RTF, it prints all
the records!

I only altered the last line of code, hoping it would do the job, but
cannot work out why it won't apply the filter, as it does on print
preview...

Here's the code, with the different line after...

Private Sub Command20_Click()

Dim strField As String
Dim strWhere As String
strWhere = BuildCriteria("FacilityID", dbLong, Me.Combo38.Value)

Select Case Me.[Frame9]
Case 1
strField = "[Continuum Of Care]"
Case 2
strField = "[Leadership & Management]"
Case 3
strField = "[Human Resources Management]"
Case 4
strField = "[Information Management]"
Case 5
strField = "[Safe Practice & Environment]"
Case 6
strField = "[Service Delivery (Area Office only)]"
End Select

If Len(strField) > 0 Then
strWhere = strWhere & " AND " & BuildCriteria(strField,
dbBoolean, True)
End If
DoCmd.OpenReport "RptEquipFull", acViewPreview, , strWhere

End Sub

here's the altered line at the end of the sub for Command 32...

DoCmd.OutputTo acOutputReport, "RptEquipFull", acFormatRTF,
"EquipReport.rtf", , strWhere


any ideas anyone?

DubboPete
 
DubboPete said:
Hi all,
The filtered report I am working on comes up with the goods when I
preview it, but when I try and output the file to RTF, it prints all
the records!

I only altered the last line of code, hoping it would do the job, but
cannot work out why it won't apply the filter, as it does on print
preview...[snip
here's the altered line at the end of the sub for Command 32...

DoCmd.OutputTo acOutputReport, "RptEquipFull", acFormatRTF,
"EquipReport.rtf", , strWhere

If you check the help topic on OutputTo you'll see that it doesn't have a WHERE
argument like OpenReport does. You need to specify a filter in the report's
open event or put the criteria in the Report's query.
 
Back
Top