Filter Function in Report Open

D

David M C

Im trying to use this code in the Open event of a Report:

Private Sub Report_Open(Cancel As Integer)
If ([Forms]![frmJobSetup2]![SelectJob].Column(2) <> "") Then
Me.Filter = [Forms]![frmJobSetup2]![SelectJob].Column(2).Text
Me.FilterOn = True
MsgBox Me.Filter
Else
End If
End Sub

to dynamically filter reports based on a selection from a combobox. If I do
it using the filter property of DoCmd.OpenReport it works, but filtering in
the open event doesn't work (ie, the report opens, but it doesn't filter,
neither does it display my MsgBox). I don't want to filter using the
OpenReport function because the report needs to be dynamically filtered at
runtime in order to use Lebans reportToPDF utility, and OutputTo (nor Lebans
utility) doesn't have a filter parameter. If I can't filter dynamically
filter, I'm going to have to create several reports with different query's to
be able to both print, preview, and output to pdf.

Any ideas?

Thanks

Dave
 

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

Similar Threads


Top