Set filter for report from form

G

Guest

I have an option group on a form to (1) Select a category
or (2) all categories for a report. I've set the filter
variable (strFilter) and use

DoCmd.OpenReport stDocName, acPreview, strFilter

to open the report. How do I set the report to accept this
filter?
 
A

Allen Browne

Use the WhereCondition instead of the filter. Example:

strFilter = "ID = " & Me.txtID
DoCmd.OpenReport stDocName, acPreview, , strFilter
 
Top