Filtering

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

I have a small database about 360 records, but I want to be able to filter
them on various criteria from time to time.
Am I able to put the filter criteria list in a combo box, and then use after
change event to run the code to filter the records?

Thanks

Alex
 
Alex said:
I have a small database about 360 records, but I want to be able to filter
them on various criteria from time to time.
Am I able to put the filter criteria list in a combo box, and then use after
change event to run the code to filter the records?


If your form doesn't have a subform, then you could use the
combo's AfterUpdate (unlikely you would need to use the
Change vent) the Filter Property.

For numeric fields:
Me.Filter = "somefield = " & Me.combo

or for text fields:
Me.Filter = "somefield = """ & Me.combo & """"

or for Date/Time fields:
Me.Filter = "somefield = " & Format(Me.combo, _
"\#m\/d\/yyyy\#

After you set the filter, remember to also do:
Me.FilterON = True
 
Back
Top