Finding the median of a filtered dataset

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?
 
M

Meg Russell

Figured it out!
Its:

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

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