Filtering Recordset Data

Filtering Recordset Data

After retrieving data into a recordset object, I want to filter this data. I tried using the objRs.filter method of ADO, but it doesn’t seem to work.

This is my syntax:

objRSEmp.Filter = "EmpName like 'b*'"

EmpName is the name of the field in my SQL table.

I tried using a session variable, but after that I can’t use any of the recordset’s properties through the new variable. Can you help?

Just setting the Filter property doesn’t do it. You then have to set the recordset object to itself or another variable, like so:

objRSEmp.Filter = "EmpName like 'b*'"Set objRSFiltered = objRSEmp

Depending on how big the recordset is, you may want to just do another query from the database. It will probably run faster, especially if you create a stored procedure to do the work for you. Also, make sure you have indexes on the fields that you are using in your filters.

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular