Filtering

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
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top