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.

Share this page:

What’s this?

Enjoy this page? Please pay it forward. Here’s how…

Would you prefer to share this page with others by linking to it?

  1. Click on the HTML link code below.
  2. Copy and paste it, adding a note of your own, into your blog, a Web page, forums, a blog comment, your Facebook account, or anywhere that someone would find this page valuable.

<a href=””>Advanced Excel – From a Business Perspective</a><a href=””>Advanced Excel – From a Business Perspective</a>hiddensecretsbookcoverhiddensecrets_online

Excel Courses for Business Professionals

How to sleep and lose weight

Copyright © 2007 – 2019. All Rights Reserved. Privacy Policy

Microsoft® and Microsoft Excel® are registered trademarks of Microsoft Corporation. is in no way associated with Microsoft

Popular Courses

Useful Links

Links I found useful and wanted to share.

Search the website