process filtered records
Posted on 2011-09-12
I need to create a mechanism that allows users to filter on a database and then write some code to process the filtered records.
Ideally I want to create a form that allows me to put some instructions, a "Select All" button and a Process records button in the header. Let's say I call that frmMain. That's easy.
Then I would like to use a subform in datasheet view so that the user can use the standard MS Access filters to display the records they want to process. Let's say I call that sfrmData. I can build that.
Once they have displayed those records I want the user to be able to select which of those records they want processed by checking the check box alongside each or by pressing the Select All button on the form. NB Each record has a field called Select, set to false when the form is first activated. That is the record I need ticked to indicate that it's a record to be processed. It's the Select All process that I don't know how to do.
Finally I want them to press the Process Records button to process the selected records. I can do that by looping through the dataset that by now has Select = True for all the records to be processed.
It's the second last step that I need help with. Is there any way I can use a Loop through only the displayed records records on a subform from a routine in the main form and set Select = True? If so, how?