Create multiple reports using Filter and save as RTF



Hello everyone - I have posted this to numerous database sites with no
solution yet. I have a report that needs to run multiple times, looping
through a strFilter and using that strFilter as the file name to save as RTF.
Right now, the reports loop using the strFilter and produces a PDF doc, but
the powers that be now want a RTF instead.

Here's the current code:
[code]
Private Sub cmdCreateBHPDFs_Click()

On Error GoTo Err_cmdCreateBHPDFs_Click


' Create Variables for Subroutine

Dim strDocName As String 'Report Name
Dim db As Database 'Database to retrieve data from
Dim strSql As String 'SQL Statement
Dim rst As Recordset 'Data Recordset
Dim strFilter As String 'Report Filter


' Set Values for Variables
strDocName = "ReportBHRepTotDetailPDF"
strSql = "SELECT SALESREP_ID FROM qryCurrentReps ORDER BY SALESREP_ID"
Set db = CurrentDb

' Open recordset containing list of Sales Reps
Set rst = db.OpenRecordset(strSql)

' Test recordset and act accordingly
If Not rst.EOF Then
' A list of Sales Reps Exists, print the reports

'Advance through the Sales Rep list, one at a time

'Go to first record of recordset
rst.MoveFirst

'Setup loop to loop through Sales Rep List
Do Until rst.EOF

'Set the report filter property to the SaleRep in the recordset,
zero base array
strFilter = "SALESREP_ID = '" & rst(0) & "'"

'Print the report using the report name and filter variables
DoCmd.OpenReport strDocName, , , strFilter


'Move to next Sales Rep
rst.MoveNext

'Loop back to top of Do Until
Loop

Else
' No Sales Reps Exist, inform the user and exit subroutine
MsgBox "No Sales Data for selected Rep", vbOKOnly, "No Reps"
Exit Sub
End If

Exit_cmdCreateBHPDFs_Click:
Exit Sub

Err_cmdCreateBHPDFs_Click:
MsgBox Err.Description
Resume Exit_cmdCreateBHPDFs_Click

End Sub[/code]

Is there a way to do this so that the files are saved with the strFilter as
the filename?

Any suggestions appreciated!

Thanks

.



Relevant Pages

  • Re: Dynamically display combo box based on selection in another combo
    ... You are also wanting to change the Visible property of the other combo box. ... DoCmd.OpenReport command to open the desired report. ... >I am looking to dynamically display a second combo box when a selection in ... > contain a choice for sales reps and once chosen, ...
    (microsoft.public.access.forms)
  • Filter and List Question
    ... I have a multi-tab report that contains information based on 20 different ... branches, about 30 Sales Managers, and 280 sales reps. ... Currently this worksheet is based on choosing the rep name ... What I would like to do it first choose a branch or manager name and then ...
    (microsoft.public.excel.misc)
  • RE: Add Data To Pivot Table
    ... instead of selecting a particualar area to take info from, drag through they ... > I made a report, requested by our sales reps, that ... > to month totals per rep. ... > How can I update the report on a monthly basis now? ...
    (microsoft.public.excel.misc)
  • Re: Add Data To Pivot Table
    ... regular contributors read all groups. ... > I made a report, requested by our sales reps, that ... > to month totals per rep. ... > How can I update the report on a monthly basis now? ...
    (microsoft.public.excel.programming)
  • Re: Populate unbound controls on report using VBA
    ... is that when I run the report, I get the student information fine, then ... a student receiving 15 points on the first submission, ... I have no problem opening the recordset, ...
    (microsoft.public.access.reports)

Loading