View Full Version : Any Access nutters know much about filters & code


paulmcdonnell
10-03-2001, 09:11 AM
Hi to all Access Nuts
What I'm trying to do is allow the user to aplly a filter on a form to reduce the amount of entries to relevant companies.

Then I want them to be able to loop through the selection and update a field in the releveant comapanies.

Now, I know how I can loop through the underlying query and update records, but how do i get my update code to loop through the filtered displayed data rather than the underlying query?

Does anyone know how I link the selected filter to the code so it only updates the filter results......?


Hope you guys can help..

Cheers
Paul

Alexandre
10-03-2001, 03:48 PM
Not tested but I wonder if me.recordsetclone would not return the filtered subset of data you want?

Alex

rich.barry
10-03-2001, 04:36 PM
My guess is to do it using a recordset.

A filter is simply a WHERE statement, so build up a select statement to define your Recordset
e.g. strSQL="SELECT Make FROM Cars WHERE " & Forms!frmCars.Filter

then open your recordset

CarRecord.Open strSQL, db, adOpenKeyset, adLockOptimistic

and do whatever you need to do to the records that have been selected using the filter