Using a forms filter string to filter query (1 Viewer)

alisalamiii

New member
Local time
Today, 08:57
Joined
Jul 29, 2008
Messages
2
Hi,

I have a database recording the results of chemical tests on cement.

I have a form called frmFilter, where the controls allow me to select the parameters and the filter works perfectly. It generates the code strWhere, much like here:
http://allenbrowne.com/ser-62.html

Now I need to be able to perform calculations (averages, min, max, standard dev, etc...) on these results.

I think I need to be able to pass this strWhere or some field on the form to a query so i can then perform the calculations on the filtered results. Is that so? or is there an easier way?
If so, so far I've got: (qryCement is the query thats pooling all the related fields together)

SELECT *
FROM qryCement
WHERE (((qryCement.tblCement_cementID)=Forms!frmFilter!cementID));

But, this only returns the first result of the filter, and not all of them.

Cheers,
Ali
 

namliam

The Mailman - AWF VIP
Local time
Today, 07:57
Joined
Aug 11, 2003
Messages
11,695
Yes you have to transfer the strWhere into the query to get the same results...
 

alisalamiii

New member
Local time
Today, 08:57
Joined
Jul 29, 2008
Messages
2
Thanks for the confirmation, but I don't actually know how to do that...

Any help on how to do that would be great?
 

namliam

The Mailman - AWF VIP
Local time
Today, 07:57
Joined
Aug 11, 2003
Messages
11,695
Currentdb.Querydefs("QueryName").SQL = "Select ... from ... " & strWhere
 

Users who are viewing this thread

Top Bottom