Multiple combo boxes as where conditions with Docmd.BrowseTo (1 Viewer)

RyLane

Registered User.
Local time
Yesterday, 20:10
Joined
Feb 4, 2014
Messages
60
Hello,

I'm using docmd.browseto to populate a subform that is filtered to a date range and combo box selection.

DoCmd.BrowseTo acReport, "Master_Report", "Main.NavigationSubform>ReportCenter.sfrReportPage", "[Activity_Date]>[TempVars]![tmpStartDate]-1 And [Activity_Date]<[TempVars]![tmpEndDate]+1 And [Activity_Type]=[cboType]", "", 1
It works perfectly but now I want to add more independent combo boxes to the form to further filter the report. I know I can keep addidng to the where conditon for each combo box.

DoCmd.BrowseTo acReport, "Master_Report", "Main.NavigationSubform>ReportCenter.sfrReportPage", "[Activity_Date]>[TempVars]![tmpStartDate]-1 And [Activity_Date]<[TempVars]![tmpEndDate]+1 And [Activity_Type]=[cboType] And [Status]=[cboStatus] And [Group] = [cboGroup]", "", 1
But this requires the selections to be made in that order, so if I go back and change one selection, I have to change them all.

Ultimately I'd like to be able to make a selection in any of the boxes in any order and have the subform updated as I make my selection. That includes not making a selection in some boxes and leaving them on the default "All".


Another option I know will work is if I create a button with docmd.openreport to filter for what is in the comboboxes. But I would like to know If it can be done the other way.

Thanks in advance,

Ryan
 

Users who are viewing this thread

Top Bottom