There are basically three techniques used to dynamically filter recordsets an Access Visual Basic where a continuous form is being used.
Our goal is to use the Store_Selection combo box to filter the records in the form.
These recordsets refer to sales and deliveries of bait to a store.
Here we will show you how to dynamically filter a continuous recordset in Visual Basic on a form. Below is the form with which we will be working:
We use the Visual Basic AfterUpdate trigger on the property sheet of the combo box. (note: there is a similar subroutine for the Year field). Here is the VBA code:
Private Sub Store_Selection_AfterUpdate()
Forms![$mainmenu]![F_History_By_Store_Final].Form.Filter = & _
Whenever the user selects a new store number the form immediately displays the new filtered recordset. You can add text boxes and combo boxes to filter on any combination of fields in the recordset. The Chr(34) is my way of putting in the double quote marks for character variables.
Copyright 2000-2013 Blue Claw Database Design, LLC