Home  Fees/Services  Microsoft Access Templates  Tutorials  Tutorial Download  Articles  Search  Contact  Privacy  Links
Recordset Filter
VBA Recordset Filter
VBA Recordset Filter  
 



 

Recordset Filter

There are basically three techniques used to dynamically filter recordsets an Access Visual Basic where a continuous form is being used.

  • Filter recordset manually using the toolbar

  • Filter VB recordset using VBA with a text field or combo box

  • Use a parameter query that read the value of a text field or combo box to filter recordset

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 = & _
"Store_ID=" & Me.Store_Selection.Column(0) & _
" and year=" & Chr(34) & Me.Year_Selection & Chr(34)

Form_F_History_By_Store_Final.Form.FilterOn=True

End Sub

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.









A Blue Claw Database Design Article:

Repair Corrupted Access Table
 





Blue Claw Database Design Downloadable Tutorial:
Access Conditional Format  





A Blue Claw Database Design Template:

Asbestos Survey Project Database
 





Contact Information

Copyright 2000-2012 Blue Claw Database Design, LLC

VBA Tutorials:
VBA Access-Google Earth
VBA Age Calculation
VBA Change Case
VBA Email via Gmail
VBA Outlook Email
VBA Read Email Access
VBA Email Attachment
VBA Send Outlook Email
VBA Running Sum
VBA Concatenate Records
VBA Stock Quotes
VBA CreateQueryDef
VBA Find Database Path
VBA Detail-Master Update
VBA Data Validation
VBA Field Value New-Old
VBA FindFirst
VBA Access Version
VBA Global Variable Parameter
VBA Global Variables
VBA Active Labels
VBA Files List Box
VBA Mail Merge
VBA Quick Sort
VBA Recordset Filters
VBA Reference Form Field
VBA Select Case
VBA Access Transactions


Visual Basic Function Examples