loop a filter in a report

R

rpschneid

I have the following module:
Option Compare Database

Dim rfilter As String
Function expgroup()
Dim rgroup As String
Dim rpath As String
Dim rs As Variant
Dim db As Variant

Set rs = CurrentDb.OpenRecordSet("group")
rs.MoveFirst
Do While Not rs.EOF
rfilter = rs![groupid]
rpath = "c:\documents and settings\areas\" & rfilter & ".rtf"
DoCmd.OutputTo acOutputReport, "gpsummary", acFormatRTF, rpath, False
rs.MoveNext
Loop
rs.Close
Set rs = Nothing

End Function

This will output the entire report into seperate rtf files by group#. (group
- data; next group - data etc) What i would like is for each rtf file only
contain the information for that group. i've tried the following on open to
no avail:
Private Sub Report_Open(Cancel As Integer)
If (rfilter) > 0 Then
Me.Filter = rfilter
rfilter = vbNullString

End If
End Sub

Help!! This is driving me nuts!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top