Problem with filter property + SQL Len() function

Posted on 2003-03-12
Medium Priority
Last Modified: 2008-03-06
Hi all,

I'm using Ado 2.5 with Access DB.
The Recordset is created at run-time so it's not connected to any Ado.Connection.

This is a simple question about Filter property of an ado Recordset. I can't set this filter when i'm writing this :

dim myRec as adodb.Recordset
dim MyLongVar as long
'here instruction to construct and fill the recordset

MyRec.Filter= "len([" & MyRec.Fields(0).Name & "])>" & MyLongVar

And then I've got the common error message "arguments are in conflict...etc."
Is it simply impossible to use the Len() function with the filter property  ?. if not i'll be sad ...

Question by:HaldriX
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

AccessHelpNet earned 300 total points
ID: 8121416
Sad but true, the ADO filter doesn't allow any functions.  It really has pretty limited functionality overall. See the docs :


Note that the .Filter doesn't even interpret parentheses logically!  Here is a quote from the above link :

There is no precedence between AND and OR. Clauses can be grouped within parentheses. However, you cannot group clauses joined by an OR and then join the group to another clause with an AND, like this:
(LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'
Instead, you would construct this filter as
(LastName = 'Smith' AND FirstName = 'John') OR (LastName = 'Jones' AND FirstName = 'John')

best regards,

Dave Kawliche

Author Comment

ID: 8126101
Thanks a lot, now I have to compute all datas in the recordset. Sh....ine !

Thanks Dave.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question