How can I filter an report?

G

Guest

Hi, I have an address table, in the filed of 'Category' , there are
'Organization, Government, and Others', now I wanna to create report for
these three categories respectively, how can I filter the report base on the
category? Thank you.
 
D

Duane Hookom

Create a combo or list box on a form that has a row source of all your
unique Category fields. Add a command button to the form to open the report.
Assuming the combo box is named "cboCategory", modify the command button
code to something like:

Dim stDocument As String
Dim strWhere As String
stDocument = "rptMyReport"
If Not IsNull(Me.cboCategory) Then
strWhere = "[Category] = """ & Me.cboCategory & """"
End If
DoCmd.OpenReport stDocument, acPreview, , strWhere
 

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