Finding the median of a filtered dataset

  • Thread starter Thread starter Meg Russell
  • Start date Start date
M

Meg Russell

I am using the Knowedge Base article Q95918 to find the median of a set of
results.
The report I am using is filtered via a form (so that various analyses can
be performed using the same report) using:

DoCmd.OpenReport "rptDataAnalysis", acViewPreview, , Me.Filter

Both the report and the form have their source in query "qryDataAnalysis".

When I include the median function in the header of my report, I get the
median of all of the the query results, but I would like the median of the
filtered query results.

How can I apply the same filter to the median function?
 
Figured it out!
Its:

Set ssMedian = MedianDB.OpenRecordset("SELECT [" & fldName$ & "] FROM
[" & tName$ & "] WHERE " & Forms![frmSearch].Filter & "ORDER BY [" & fldName$
& "];")
 
Back
Top