QueryDef w/ A Filter?

  • Thread starter Thread starter Bob Barnes
  • Start date Start date
B

Bob Barnes

I can easily write Queries to get "All" values from
(as an example) "All Employees". Then opening a Report
with no Filter in the DoCmd.OpenReport shows "All
Employees".

I can use an unbound Dropdown to select an Employee &
use the Filter argument in DoCmd.OpenReport to find only
Records for that Employee.

In both scenarios, it uses the same Query.

I have a very long "Sub" that sends Access data to Excel.
It uses several Queries getting "Top 5", etc. I use
QueryDefs very effectively to get data from both
Production Shifts.

I can use an unbound Dropdown to select either 1st or 2nd
Shift. Without writing other QueryDefs to get the
appropriate Shift, is there a way to "Filter" a QueryDef
without writing another Query?

TIA - Bob
 
I would think creating an AND condition in the Where parameter of the
OpenReport Method would suffice.

i.e. Docmd.openreport "rptName", where := "EmpID= " & cboEmpID & _
" AND Shift = " & cboShift


--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Back
Top