Connect to Database

Assuming that you have retrieve the records from a database and now you want to filter the records further with more criteria. You can use the following code which filters the records using 2 criterias:

RS.Filter = "componentName = 'Monthly Salary' AND PayMonth = 1"

ComponentName is the 1st field name.
Monthly Salary is the value to filter. It has to be presented between 2 singles quotes.
PayMonth is the 2nd field name
1 is the value to filter. Single quotes is not needed because it is a number.

To remove the filter, use

RS.Filter = adFilterNone


New! Comments

Have your say about what you just read! Leave me a comment in the box below.